{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Simple XGBoost tutorial\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We will use the trivial **Iris Dataset** which you can get from directly from sklearn or from the UCI repository.\n",
    "\n",
    "First of all, let's import what is needed:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import xgboost as xgb\n",
    "from sklearn import datasets\n",
    "from sklearn.model_selection import train_test_split"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Load the Iris dataset and split in train and test following the thumb rule of 80/20:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'data': array([[5.1, 3.5, 1.4, 0.2],\n",
       "        [4.9, 3. , 1.4, 0.2],\n",
       "        [4.7, 3.2, 1.3, 0.2],\n",
       "        [4.6, 3.1, 1.5, 0.2],\n",
       "        [5. , 3.6, 1.4, 0.2],\n",
       "        [5.4, 3.9, 1.7, 0.4],\n",
       "        [4.6, 3.4, 1.4, 0.3],\n",
       "        [5. , 3.4, 1.5, 0.2],\n",
       "        [4.4, 2.9, 1.4, 0.2],\n",
       "        [4.9, 3.1, 1.5, 0.1],\n",
       "        [5.4, 3.7, 1.5, 0.2],\n",
       "        [4.8, 3.4, 1.6, 0.2],\n",
       "        [4.8, 3. , 1.4, 0.1],\n",
       "        [4.3, 3. , 1.1, 0.1],\n",
       "        [5.8, 4. , 1.2, 0.2],\n",
       "        [5.7, 4.4, 1.5, 0.4],\n",
       "        [5.4, 3.9, 1.3, 0.4],\n",
       "        [5.1, 3.5, 1.4, 0.3],\n",
       "        [5.7, 3.8, 1.7, 0.3],\n",
       "        [5.1, 3.8, 1.5, 0.3],\n",
       "        [5.4, 3.4, 1.7, 0.2],\n",
       "        [5.1, 3.7, 1.5, 0.4],\n",
       "        [4.6, 3.6, 1. , 0.2],\n",
       "        [5.1, 3.3, 1.7, 0.5],\n",
       "        [4.8, 3.4, 1.9, 0.2],\n",
       "        [5. , 3. , 1.6, 0.2],\n",
       "        [5. , 3.4, 1.6, 0.4],\n",
       "        [5.2, 3.5, 1.5, 0.2],\n",
       "        [5.2, 3.4, 1.4, 0.2],\n",
       "        [4.7, 3.2, 1.6, 0.2],\n",
       "        [4.8, 3.1, 1.6, 0.2],\n",
       "        [5.4, 3.4, 1.5, 0.4],\n",
       "        [5.2, 4.1, 1.5, 0.1],\n",
       "        [5.5, 4.2, 1.4, 0.2],\n",
       "        [4.9, 3.1, 1.5, 0.2],\n",
       "        [5. , 3.2, 1.2, 0.2],\n",
       "        [5.5, 3.5, 1.3, 0.2],\n",
       "        [4.9, 3.6, 1.4, 0.1],\n",
       "        [4.4, 3. , 1.3, 0.2],\n",
       "        [5.1, 3.4, 1.5, 0.2],\n",
       "        [5. , 3.5, 1.3, 0.3],\n",
       "        [4.5, 2.3, 1.3, 0.3],\n",
       "        [4.4, 3.2, 1.3, 0.2],\n",
       "        [5. , 3.5, 1.6, 0.6],\n",
       "        [5.1, 3.8, 1.9, 0.4],\n",
       "        [4.8, 3. , 1.4, 0.3],\n",
       "        [5.1, 3.8, 1.6, 0.2],\n",
       "        [4.6, 3.2, 1.4, 0.2],\n",
       "        [5.3, 3.7, 1.5, 0.2],\n",
       "        [5. , 3.3, 1.4, 0.2],\n",
       "        [7. , 3.2, 4.7, 1.4],\n",
       "        [6.4, 3.2, 4.5, 1.5],\n",
       "        [6.9, 3.1, 4.9, 1.5],\n",
       "        [5.5, 2.3, 4. , 1.3],\n",
       "        [6.5, 2.8, 4.6, 1.5],\n",
       "        [5.7, 2.8, 4.5, 1.3],\n",
       "        [6.3, 3.3, 4.7, 1.6],\n",
       "        [4.9, 2.4, 3.3, 1. ],\n",
       "        [6.6, 2.9, 4.6, 1.3],\n",
       "        [5.2, 2.7, 3.9, 1.4],\n",
       "        [5. , 2. , 3.5, 1. ],\n",
       "        [5.9, 3. , 4.2, 1.5],\n",
       "        [6. , 2.2, 4. , 1. ],\n",
       "        [6.1, 2.9, 4.7, 1.4],\n",
       "        [5.6, 2.9, 3.6, 1.3],\n",
       "        [6.7, 3.1, 4.4, 1.4],\n",
       "        [5.6, 3. , 4.5, 1.5],\n",
       "        [5.8, 2.7, 4.1, 1. ],\n",
       "        [6.2, 2.2, 4.5, 1.5],\n",
       "        [5.6, 2.5, 3.9, 1.1],\n",
       "        [5.9, 3.2, 4.8, 1.8],\n",
       "        [6.1, 2.8, 4. , 1.3],\n",
       "        [6.3, 2.5, 4.9, 1.5],\n",
       "        [6.1, 2.8, 4.7, 1.2],\n",
       "        [6.4, 2.9, 4.3, 1.3],\n",
       "        [6.6, 3. , 4.4, 1.4],\n",
       "        [6.8, 2.8, 4.8, 1.4],\n",
       "        [6.7, 3. , 5. , 1.7],\n",
       "        [6. , 2.9, 4.5, 1.5],\n",
       "        [5.7, 2.6, 3.5, 1. ],\n",
       "        [5.5, 2.4, 3.8, 1.1],\n",
       "        [5.5, 2.4, 3.7, 1. ],\n",
       "        [5.8, 2.7, 3.9, 1.2],\n",
       "        [6. , 2.7, 5.1, 1.6],\n",
       "        [5.4, 3. , 4.5, 1.5],\n",
       "        [6. , 3.4, 4.5, 1.6],\n",
       "        [6.7, 3.1, 4.7, 1.5],\n",
       "        [6.3, 2.3, 4.4, 1.3],\n",
       "        [5.6, 3. , 4.1, 1.3],\n",
       "        [5.5, 2.5, 4. , 1.3],\n",
       "        [5.5, 2.6, 4.4, 1.2],\n",
       "        [6.1, 3. , 4.6, 1.4],\n",
       "        [5.8, 2.6, 4. , 1.2],\n",
       "        [5. , 2.3, 3.3, 1. ],\n",
       "        [5.6, 2.7, 4.2, 1.3],\n",
       "        [5.7, 3. , 4.2, 1.2],\n",
       "        [5.7, 2.9, 4.2, 1.3],\n",
       "        [6.2, 2.9, 4.3, 1.3],\n",
       "        [5.1, 2.5, 3. , 1.1],\n",
       "        [5.7, 2.8, 4.1, 1.3],\n",
       "        [6.3, 3.3, 6. , 2.5],\n",
       "        [5.8, 2.7, 5.1, 1.9],\n",
       "        [7.1, 3. , 5.9, 2.1],\n",
       "        [6.3, 2.9, 5.6, 1.8],\n",
       "        [6.5, 3. , 5.8, 2.2],\n",
       "        [7.6, 3. , 6.6, 2.1],\n",
       "        [4.9, 2.5, 4.5, 1.7],\n",
       "        [7.3, 2.9, 6.3, 1.8],\n",
       "        [6.7, 2.5, 5.8, 1.8],\n",
       "        [7.2, 3.6, 6.1, 2.5],\n",
       "        [6.5, 3.2, 5.1, 2. ],\n",
       "        [6.4, 2.7, 5.3, 1.9],\n",
       "        [6.8, 3. , 5.5, 2.1],\n",
       "        [5.7, 2.5, 5. , 2. ],\n",
       "        [5.8, 2.8, 5.1, 2.4],\n",
       "        [6.4, 3.2, 5.3, 2.3],\n",
       "        [6.5, 3. , 5.5, 1.8],\n",
       "        [7.7, 3.8, 6.7, 2.2],\n",
       "        [7.7, 2.6, 6.9, 2.3],\n",
       "        [6. , 2.2, 5. , 1.5],\n",
       "        [6.9, 3.2, 5.7, 2.3],\n",
       "        [5.6, 2.8, 4.9, 2. ],\n",
       "        [7.7, 2.8, 6.7, 2. ],\n",
       "        [6.3, 2.7, 4.9, 1.8],\n",
       "        [6.7, 3.3, 5.7, 2.1],\n",
       "        [7.2, 3.2, 6. , 1.8],\n",
       "        [6.2, 2.8, 4.8, 1.8],\n",
       "        [6.1, 3. , 4.9, 1.8],\n",
       "        [6.4, 2.8, 5.6, 2.1],\n",
       "        [7.2, 3. , 5.8, 1.6],\n",
       "        [7.4, 2.8, 6.1, 1.9],\n",
       "        [7.9, 3.8, 6.4, 2. ],\n",
       "        [6.4, 2.8, 5.6, 2.2],\n",
       "        [6.3, 2.8, 5.1, 1.5],\n",
       "        [6.1, 2.6, 5.6, 1.4],\n",
       "        [7.7, 3. , 6.1, 2.3],\n",
       "        [6.3, 3.4, 5.6, 2.4],\n",
       "        [6.4, 3.1, 5.5, 1.8],\n",
       "        [6. , 3. , 4.8, 1.8],\n",
       "        [6.9, 3.1, 5.4, 2.1],\n",
       "        [6.7, 3.1, 5.6, 2.4],\n",
       "        [6.9, 3.1, 5.1, 2.3],\n",
       "        [5.8, 2.7, 5.1, 1.9],\n",
       "        [6.8, 3.2, 5.9, 2.3],\n",
       "        [6.7, 3.3, 5.7, 2.5],\n",
       "        [6.7, 3. , 5.2, 2.3],\n",
       "        [6.3, 2.5, 5. , 1.9],\n",
       "        [6.5, 3. , 5.2, 2. ],\n",
       "        [6.2, 3.4, 5.4, 2.3],\n",
       "        [5.9, 3. , 5.1, 1.8]]),\n",
       " 'target': array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
       "        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
       "        0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\n",
       "        2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\n",
       "        2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]),\n",
       " 'target_names': array(['setosa', 'versicolor', 'virginica'], dtype='<U10'),\n",
       " 'DESCR': '.. _iris_dataset:\\n\\nIris plants dataset\\n--------------------\\n\\n**Data Set Characteristics:**\\n\\n    :Number of Instances: 150 (50 in each of three classes)\\n    :Number of Attributes: 4 numeric, predictive attributes and the class\\n    :Attribute Information:\\n        - sepal length in cm\\n        - sepal width in cm\\n        - petal length in cm\\n        - petal width in cm\\n        - class:\\n                - Iris-Setosa\\n                - Iris-Versicolour\\n                - Iris-Virginica\\n                \\n    :Summary Statistics:\\n\\n    ============== ==== ==== ======= ===== ====================\\n                    Min  Max   Mean    SD   Class Correlation\\n    ============== ==== ==== ======= ===== ====================\\n    sepal length:   4.3  7.9   5.84   0.83    0.7826\\n    sepal width:    2.0  4.4   3.05   0.43   -0.4194\\n    petal length:   1.0  6.9   3.76   1.76    0.9490  (high!)\\n    petal width:    0.1  2.5   1.20   0.76    0.9565  (high!)\\n    ============== ==== ==== ======= ===== ====================\\n\\n    :Missing Attribute Values: None\\n    :Class Distribution: 33.3% for each of 3 classes.\\n    :Creator: R.A. Fisher\\n    :Donor: Michael Marshall (MARSHALL%PLU@io.arc.nasa.gov)\\n    :Date: July, 1988\\n\\nThe famous Iris database, first used by Sir R.A. Fisher. The dataset is taken\\nfrom Fisher\\'s paper. Note that it\\'s the same as in R, but not as in the UCI\\nMachine Learning Repository, which has two wrong data points.\\n\\nThis is perhaps the best known database to be found in the\\npattern recognition literature.  Fisher\\'s paper is a classic in the field and\\nis referenced frequently to this day.  (See Duda & Hart, for example.)  The\\ndata set contains 3 classes of 50 instances each, where each class refers to a\\ntype of iris plant.  One class is linearly separable from the other 2; the\\nlatter are NOT linearly separable from each other.\\n\\n.. topic:: References\\n\\n   - Fisher, R.A. \"The use of multiple measurements in taxonomic problems\"\\n     Annual Eugenics, 7, Part II, 179-188 (1936); also in \"Contributions to\\n     Mathematical Statistics\" (John Wiley, NY, 1950).\\n   - Duda, R.O., & Hart, P.E. (1973) Pattern Classification and Scene Analysis.\\n     (Q327.D83) John Wiley & Sons.  ISBN 0-471-22361-1.  See page 218.\\n   - Dasarathy, B.V. (1980) \"Nosing Around the Neighborhood: A New System\\n     Structure and Classification Rule for Recognition in Partially Exposed\\n     Environments\".  IEEE Transactions on Pattern Analysis and Machine\\n     Intelligence, Vol. PAMI-2, No. 1, 67-71.\\n   - Gates, G.W. (1972) \"The Reduced Nearest Neighbor Rule\".  IEEE Transactions\\n     on Information Theory, May 1972, 431-433.\\n   - See also: 1988 MLC Proceedings, 54-64.  Cheeseman et al\"s AUTOCLASS II\\n     conceptual clustering system finds 3 classes in the data.\\n   - Many, many more ...',\n",
       " 'feature_names': ['sepal length (cm)',\n",
       "  'sepal width (cm)',\n",
       "  'petal length (cm)',\n",
       "  'petal width (cm)'],\n",
       " 'filename': '/home/maurizio/anaconda3/lib/python3.6/site-packages/sklearn/datasets/data/iris.csv'}"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "iris = datasets.load_iris()\n",
    "iris"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = iris.data\n",
    "y = iris.target\n",
    "\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Use **DMatrix** as data structures for both train and test. \n",
    "\n",
    "DMatrix is a internal data structure that used by XGBoost which is optimized for both memory efficiency and training speed.\n",
    "You can construct DMatrix from numpy.arrays:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "dtrain = xgb.DMatrix(X_train, label=y_train)\n",
    "dtest = xgb.DMatrix(X_test, label=y_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Set XGBoost parameters:\n",
    "\n",
    "merror: Multiclass classification error rate. It is calculated as #(wrong cases)/#(all cases)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "params = {\n",
    "    'max_depth': 3,  # the maximum depth of each tree\n",
    "    'eta': 0.3,  # step for each iteration\n",
    "    'silent': 1, # keep it quiet\n",
    "    'objective': 'multi:softprob',  # error evaluation for multiclass training\n",
    "    'num_class': 3, # the number of classes \n",
    "    'eval_metric': 'merror'} # evaluation metric \n",
    "\n",
    "num_round = 20  # the number of training iterations (number of trees)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Create a model and fit it with params:\n",
    "\n",
    "(We could have used also XGBClassifier, which is a scikit-learn compatible class. It is basically just a wrapper over the xgb.train function)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0]\ttrain-merror:0.016667\n",
      "[2]\ttrain-merror:0.016667\n",
      "[4]\ttrain-merror:0.016667\n",
      "[6]\ttrain-merror:0.016667\n",
      "[8]\ttrain-merror:0.016667\n",
      "[10]\ttrain-merror:0.016667\n",
      "[12]\ttrain-merror:0.016667\n",
      "[14]\ttrain-merror:0.016667\n",
      "[16]\ttrain-merror:0.016667\n",
      "[18]\ttrain-merror:0.008333\n",
      "[19]\ttrain-merror:0.008333\n"
     ]
    }
   ],
   "source": [
    "model = xgb.train(params,\n",
    "                  dtrain,\n",
    "                  num_round,\n",
    "                  verbose_eval=2,\n",
    "                  evals=[(dtrain, 'train')])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Precision: 0.95 %\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import precision_score\n",
    "\n",
    "preds = model.predict(dtest)\n",
    "best_preds = np.asarray([np.argmax(line) for line in preds])\n",
    "print(\"Precision: {:.2f} %\".format(precision_score(y_test, best_preds, average='macro')))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "It is possible to show with an histogram the importance of each feature:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "from xgboost import plot_importance"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Gain:** it implies the relative contribution of the corresponding feature to the model calculated by taking each feature's contribution for each tree in the model. A higher value of this metric when compared to another feature implies it is more important for generating a prediction."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7f37541cfc18>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgUAAAEWCAYAAAD2NuSlAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3Xucz3X+///bg4kcihHaahyaEOM0OaS+nUa7KJVqyaE+0mmVtC3bgWqJaiuLVodf2ydyKCGrDVubWAyScsgkUvTJ5FiYHBphxnj8/ni/vHuPwxjynvfkfb9eLu+L9+v1er6er8fzPXjf5/l6vd5vc3dERERESsS6ABERESkeFApEREQEUCgQERGRgEKBiIiIAAoFIiIiElAoEBEREUChQOQXMbPqZpZtZiVjXYuIyC+lUCACmFlnM/vEzHaZ2ebg+b1mZgXt5+5r3b28u+cVVa0iItGiUCBxz8weAJ4HBgO/Ac4E7gEuAUrFsDQRkSJl+kRDiWdmVgHYCNzq7m8foc01wFPAecAO4DV3HxBsqwmsAU5x931mlg7MA64EGgELgJvdfWtUByIicgJopkDi3cVAaWBKAW12AbcCFYFrgB5mdkMB7W8GbgeqEpppePDElCoiEl0KBRLvKgNb3X3fgRVm9pGZbTez3WZ2ubunu/vn7r7f3ZcB44ErCuhzlLuvcvfdwEQgNbpDEBE5MRQKJN5lAZXNLOHACnf/f+5eMdhWwsxamNlsM9tiZjsIXW9QuYA+v4t4/hNQPhqFi4icaAoFEu8WAHuB6wtoMw6YClRz9wrAK0CBdyWIiPwaKRRIXHP37cBA4GUz62Bm5c2shJmlAuWCZqcBP7j7H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1aniFChU8MTHRX3zxRXd3z8nJ8datW/vQoUOPOO7MzEyvX7++u7vXrFkz3Fe5cuW8SpUq/s477xyyX5cuXfy9997zzZs3e3Jycnj9t99+6/Xq1XN397vvvttHjRoV3nbllVf6woUL3d19x44dfsEFF/jEiROP9PL67Nmz/Zprrjni9l/qeH7mJ4N4Hbd79MYOLPZC/j+rhx4HPwo8feDuJd39dHc/zd0TgucHlk8vaF8pWs2bN2f16tWsWbOGnJwcJkyYQLt27fK1Wbp0KXfffTdTp07Nd46+TZs2TJ8+nW3btrFt2zamT59OmzZtMDOuu+668G8zM2fODF+42K5du/BdCpMmTeLKK6/EzJg3bx6ZmZlkZmbSq1cvHn30Ue677z7cnTvvvJN69erx5z//OV9dq1evDj+fOnUqdevWBUIzFgf66tChAy+//DI33HADeXl5ZGVlAbBs2TKWLVtG69atSUxMZMeOHaxatQoIzYjUq1cPgBtuuIHZs2cDsHXrVlatWkVycjI5OTnceOON3Hrrrdx000356tq0aRMQCs6TJ0+mQYMGx/nTERH5dSjs5xRIMZeQkMBLL71EmzZtyMvL44477qB+/fr079+fZs2a0a5dOx566CGys7PDb37Vq1dn6tSpVKpUiX79+tG8eXMA+vfvT6VKlQAYNGgQXbt2pVevXlSpUoVRo0YBcOedd9K1a1dq1apFpUqVmDBhQoH1zZ8/nzfeeIOGDRuSmhr61u2nn36atm3b0rdvX7766it2795NSkpK+M6DI8nNzeWyyy4DQhcpjh07loSE0F/l4cOH0759e0qUKEFiYiIjR44Efg4+KSkplCxZksGDB3PGGWcwduxY5s6dS1ZWFqNHjwZg9OjRpKamcsstt7BlyxbcndTU1KPWJSLya2fu0flgQjPLBJoRCh6LgdOB/UA2kOLuOwva//zzz/evvvoqKrUVd+np6aSlpcW6jCIXr+OG+B17vI4bojd2M1vi7s1OeMcSF6I2U+DuNSMWk6J1HBERETkxCvuJhiIiInKSUygQERERQKFAREREAgoFIiIiAigUiIiISEChQERERACFAhEREQkoFIiIiAigUCAiIiIBhQIREREBFApEREQkoFAgIiIigEKBiIiIBBQKREREBFAoEBERkYBCgYiIiAAKBSIiIhJQKBARERFAoUBEREQCCgUiIiICKBSIiIhIQKFAREREAIUCERERCSgUiIiICKBQICIiIgGFAhEREQEUCkRERCSgUCAiIiKAQoGIiIgEFApEREQEUCgQERGRgEKBiIiIAAoFIiIiEii2oWB3bh41+75X6Ee8mzZtGueffz61atXi2WefPWT73LlzadKkCQkJCUyaNCnftocffpj69etTr1497r//ftydH3/8kdTU1PCjcuXK9OrV66iXguNvAAAOm0lEQVR9jRkzhtq1a1O7dm3GjBkDUGBfB0yaNImWLVuyePFiADIzMylTpkx4n3vuueeQMbVr144GDRocsn7IkCGYGVu3bgVg8ODB4X4aNGhAyZIl+eGHH9izZw8XXnghjRs3pn79+jz++OPhPmbNmkWTJk1o0KAB3bp1Y9++fQB8+eWXXHzxxZQuXZohQ4aE2xfU15o1a2jRogW1a9emU6dO5OTkADB69GiqVKlCamoqd911FyNGjDhkLCIiRSmqocDM7jezlWb2ppm9YGZfm9kyM2sSzePGm7y8PHr27Mn777/PF198wfjx4/niiy/ytalevTqjR4/m5ptvzrf+o48+Yv78+Sxbtozly5ezaNEi5syZw2mnnUZGRkb4UaNGDX7/+98X2NcPP/zAwIED+eSTT1i4cCEDBw5k27ZtBfYFodDwwgsvUK9evXz9nXfeeeF9XnnllXzb/vWvf1G+fPlDXot169YxY8YMqlevHl730EMPhft55plnuOKKK6hUqRKlS5dm1qxZfPbZZ2RkZDBt2jQ+/vhj9u/fT7du3ZgwYQLLly+nRo0a4YBTqVIlXnjhBR588MF8xz1SXwB9+vShd+/erF69msTERF577bXwfp06dSIjI4MRI0Zw1113HeanKyJSdKI9U3Av0BZ4E6gdPLoD/4jycePKwoULqVWrFsnJyZQqVYrOnTszZcqUfG1q1qxJo0aNKFEi/4/czNizZw85OTns3buX3NxczjzzzHxtVq9ezebNm7nssssK7OuDDz6gVatWVKpUicTERFq1asW0adMK7AugX79+PPzww5QqVapQ483Ozua5557jL3/5yyHbevfuzd/+9jfM7LD7jh8/ni5duoTHfiBY5Obmkpubi5mRlZVF6dKlqVOnDgCtWrXi7bffBqBq1ao0b96cU045JV+/R+rL3Zk1axYdOnQAoFu3bkyePLlQ4xQRKWpRCwVm9gqQDEwF3gFe95CPgYpmdla0jh1vNmzYQLVq1cLLSUlJbNiwoVD7XnzxxbRs2ZKzzjqLs846izZt2hzyG/v48ePp1KnTEd9oj6WOg/taunQp69at49prrz2kvzVr1nDBBRdwxRVXMG/evPD6fv368cADD1C2bNl87adOnco555xD48aND1vfTz/9xLRp02jfvn14XV5eHqmpqVStWpVWrVrRokULKleuTG5ubvhUxqRJk1i3bl2BYz9SX1lZWVSsWJGEhITDviZvv/02jRo14vHHHy/UMUREoikhWh27+z1mdhXQEhgNRP6Ptx44B9gUuY+ZdSc0k0DlylXo33BfoY+Xnp7+ywouRrKzs49pPMuXL2fTpk3hfVauXMnGjRsP28d3333HihUrqFy5MhB6I//www8ZP348AA8++CBVq1bN98Y6cuRIHnnkkUP6O7ivr7/+mtzc3HC7NWvWcOqpp+bbL7Kv/fv38+c//5m+ffuSnp5OXl4eS5YsITs7m5ycHMaNG0eFChX46quvaN++PaNGjWLTpk188sknXH/99Xz88cfs2rWL9PR09uzZQ58+fRg8eHB4ef78+VSoUCF87FmzZlG3bl2WLVuWbxzDhg0jOzubfv36UbduXc4991wefvhh7rjjDnJzc2nWrBl79uzJN44D1zwc/Joc3FdiYiK7d+8Ot9u8eTM//fQT6enpJCYmMmbMGEqVKsU///lPrr/+ep577rmCftQnnWP9u34yieexS/EVtVBwkMP9iumHrHB/FXgVoHpyLR/6eeHLy7wl7XhrK3bS09NJS0srdPvSpUuzYMGC8D4LFiygefPmh+1j9OjR1K9fP7xt8ODBXHPNNVx99dUALFq0iL1794a3f/bZZ5QqVYq77777qH0dCCYHlsePH89ll112xL527NjB+vXr6du3LwAbN25k4MCBTJ06lWbNmoWPk5aWxvjx4znzzDNZu3YtmZmZ3Hbbbezbt4/NmzczYMAAXnzxRbKysrjvvvsA2Lp1K3/84x9ZuHAhv/nNbwB4/vnnue+++4742i5ZsoSsrCxuv/120tLS6NmzJwDTp0/P95pA6GdUvnz5o/Z12223cdddd3HppZeSkJDAggULqF279iH75eXlMXbs2GP6uZ8MjvXv+skknscuxVdR3X2wHqgWsZwEbCyiY5/0mjdvzurVq1mzZg05OTlMmDCBdu3aFWrf6tWrM2fOHPbt20dubi5z5szJd/og8hz80bRp04bp06ezbds2tm3bxvTp02nTps0R+6pQoQJbt24lMzOTzMxMUlJSwoFgy5Yt5OXlAfDNN9+wevVqkpOT6dGjBxs3biQzM5MPP/yQOnXqkJ6eTsOGDdm8eXO4r6SkJD799NNwINixYwdz5szh+uuvDx9/y5YtbN++HYDdu3fz3//+l7p16wKh3+gB9u7dy6BBgw5790OkI/VlZrRs2TJ8l8aYMWPCNWza9PNE2UcffXTIaRsRkaJWVDMFU4H7zGwC0ALY4e6bjrKPFFJCQgIvvfQSbdq0IS8vjzvuuIP69evTv39/mjVrRrt27Vi0aBE33ngj27Zt49///jePP/44K1asoEOHDsyaNYuGDRtiZlx11VVcd9114b4nTpzIf/7zn3zHO1JflSpVol+/fjRv3hyA/v37U6lSpQL7OpK5c+fSv39/EhISKFmyJK+88kq+vo7VO++8Q+vWrSlXrlx43aZNm+jWrRt5eXns37+fjh07hq9tGDx4MO+++y779++nR48eXHnllUDolEmzZs3YuXMnJUqUYNiwYXzxxRcF9jVo0CA6d+7MX/7yFy644ALuvPNOAF544QWmTp1KQkICJUqUCJ/CERGJFXM/ZBb/xHVulgk0A7KAl4CrgJ+A2919cUH7Vk+u5SU6Pl/oY2U+e83xF1rMxOu0YryOG+J37PE6boje2M1sibs3O3pLkUNFdabA3WtGLPY8ln3LnFKSr06iN3oREZHirth+oqGIiIgULYUCERERARQKREREJKBQICIiIoBCgYiIiAQUCkRERARQKBAREZGAQoGIiIgACgUiIiISUCgQERERQKFAREREAgoFIiIiAigUiIiISEChQERERACFAhEREQkoFIiIiAigUCAiIiIBhQIRE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2UR3XxHbqoqGmY0HFgDnm9l6M7sz1jUVkUuAroR+Y8wIHm1jXVQROAuYbWbLCIXhGe4eV7fnxaEzgQ/N7DNgIfCeu0+LcU0iYcXulkQRERGJjWI3UyAiIiKxoVAgIiIigEKBiIiIBBQKREREBFAoEBERkUBCrAsQKWpmlgd8HrHqBnfPjFE5IiLFhm5JlLhjZtnuXr4Ij5cQfP6GiEixptMHIgcxs7PMbG7wIUrLzeyyYP1VZvapmX1mZjODdZXMbLKZLTOzj82sUbB+gJm9ambTgdeDLz4abGaLgrZ3x3CIIiKHpdMHEo/KBN9MCLDG3W88aPvNwAfu/lczKwmUNbMqwHDgcndfY2aVgrYDgaXufoOZXQm8DqQG25oCl7r77uDb8Ha4e3MzKw3MN7Pp7r4mmgMVETkWCgUSj3YH30x4JIuAkcGXNE129wwzSwPmHngTd/cfgraXAu2DdbPM7AwzqxBsm+ruu4PnrYFGZtYhWK4A1AYUCkSk2FAoEDmIu88Nvs72GuANMxsMbOfwX+Fd0Fd97zqo3R/d/YMTWqyIyAmkawpEDmJmNYDN7j6c0Lc3NiH0RVVXmNm5QZsDpw/mArcE69KAre6+8zDdfgD0CGYfMLM6wbfkiYgUG5opEDlUGvCQmeUC2cCt7r4luC7gX2ZWAtgMtAIGAKOCbzr8Ceh2hD5HADWBT4Ovit4C3BDNQYiIHCvdkigiIiKATh+IiIhIQKFAREREAIUCERERCSgUiIiICKBQICIiIgGFAhEREQEUCkRERCTw/wM9HgYXx0UkUAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_importance(model, importance_type='gain', title='Gain')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Cover:** The Cover metric means the relative number of observations related to this feature. Therefore is the number of observations for which the leaf node is determined by the feature. This number will be calculated for all the features in the dataset and the cover will be expressed as a percentage over all features' cover metrics."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7f37540fa9b0>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAd4AAAEWCAYAAADIJfYaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3Xl8FPX9x/HXJ0RBUFAEFAkIGOU+iqjw00IQUS7jhVRqRa4qgopaUNRqwVqhIK1YbVXwPsCqoLReUDSoVOS+bzXKIUIoiOFM4PP7YyfbTUhCsGSShffz8dgHOzPf+c5nJ8u+d74zu2vujoiIiIQjoaQLEBEROZYoeEVEREKk4BUREQmRgldERCRECl4REZEQKXhFRERCpOAVEREJkYJXjllm9kszm2tmmWb2nZm9b2YXlXRdInJ0U/DKMcnM7gIeAx4BTgNqAX8Frghp+2Zm+v8ncgzSf3w55phZJeAhYKC7T3L3ne6e5e7/cPchZlbWzB4zs43B7TEzKxusu8LMusb0lWhmGWbWIphuZWb/NrPtZrbIzFJi2qaZ2R/MbCawC6gb6gMXkVJBwSvHotZAOWByAcvvB1oBzYFmwPnAb4NlE4AeMW0vAzLcfb6Z1QDeBR4GKgODgbfMrGpM+xuAm4CTgG+OyKMRkbii4JVj0alEwjK7gOXXAw+5+2Z33wIMJxKYAK8BqWZWPpj+ZTAP4FfAe+7+nrsfcPdpwFygc0zfL7j7MnfPdvesI/mgRCQ+KHjlWLQVqGJmiQUsP4PcR6PfBPNw97XACuDyIHxT+W/wnglcGwwzbzez7cBFQPWYvtYduYchIvGooBcekaPZ58Ae4ErgzXyWbyQSosuC6VrBvBw5w80JwPIgjCESqi+7+68L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2sFoC7H3D3ce5+rbt3C+4fcqjZzG43sxVm9qqZPW5ma81ssZm1OFIPQI6ssWPH0qBBg3yXPfvss5xyyimsXbuWO++8k3vuuQeAcuXK8fvf/55HH3003/UmTZrEiSeemGvekCFDWLx4MQsXLqRr16489NBDAGzfvp0BAwYwZcoUli1bxhtvvAFAYmIiY8aMYcWKFcyaNYsnn3wyGvyNGzdm0qRJtGnTJtc2li9fzsSJE1m2bBkffPABAwYMYP/+/dSrV4+FCxeycOFC5s2bR/ny5bnqqqsKreuRRx6hefPmLF68mJdeeolBgwZFt9OrVy8++OCDgx53QX29//77rFmzhjVr1vDMM89wyy23RNc54YQTorVNmTIl3/0pIvHtUEe80SuXzeytn9D/AKAz8CpwdnC7CfjbT+hLitn69et599136devX77L33nnHW688UYAunXrxvTp03F3KlSowEUXXUS5cuUOWiczM5M//elP/Pa3uQdIKlasGL2/c+dOzAyA1157jauvvppatWoBUK1a5Bq+6tWr06JF5P3aSSedRIMGDcjIyACgQYMG1KtXL996r7vuOsqWLUudOnVITk5m9uzZudpMnz6ds846izPPPLPQupYvX0779u0BqF+/Punp6Xz//fcAtGnThsqVKx+0/YL6euedd+jZsydmRqtWrdi+fTvffffdQeuLyNHpUMFrMffrHk7HZvZUsM4UYDLwkkfMAk42s+qHVakUuzvuuINRo0aRkJD/02LDhg3UrFkTiByBVqpUia1btxba5wMPPMBvfvMbypcvf9Cy+++/n5o1a/Lqq69GjwZXr17Ntm3bSElJ4dxzz+Wll146aL309HQWLFhQ4JF5fvUCJCUlsWHDhlxtJk6cSI8ePQ5ZV7NmzZg0aRIAs2fP5ptvvmH9+vWFbr+gvgqra8+ePbRs2ZJWrVrx9tv6xJ7I0ehQF1d5AfcPyd37m1lHoB3wArAuZvF6Ip8FzvU238xuInJETJUqVXmwSfx9K+VpJ0QusApDWlraEeknMzOTESNGkJWVxY8//sjChQvZunXrQf1nZmby+eefU7VqVSASEjNnzqRSpUoArFy5kg0bNkTXW7t2LV988QVXXHEFs2bNYufO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QkJnHnmmTz11FNA5EKpjh070rRpUxISEujXrx+NGzfms88+4+WXX6ZJkyY0bx75RcrrrruOlJQUJk+ezG233caWLVvo0qULzZs358MPP6RRo0Z0796dhg0bkpiYyJNPPkmZMpGvGN+1axfTpk3j6aefLlJdK1asoGfPnpQpU4aGDRvy7LPPRtfp0aMHaWlpZGRkkJSUxPDhw+nbt2++fa1Zs4bOnTvz3nvvkZycTPny5Xn++eej27j55ptJSEjgwIEDDB06VMErchSyInwq6Kd3bpYOtAS2Ak8AHYn8ylFvd59byKoYOIxoAAAT3klEQVTUq1fPV61aVWy1FZd4HCqKx5ohPuuOx5ohPus+Vms2s3nu3vLIVCTFoViPeN29dszkwOLcloiISDwo6jdXiYiIyBGg4BUREQmRgldERCRECl4REZEQKXhFRERCpOAVEREJkYJXREQkRApeERGRECl4RUREQqTgFRERCZGCV0REJEQKXhERkRApeEVEREKk4BUREQmRgldERCRECl4REZEQKXhFRERCpOAVEREJkYJXREQkRApeERGRECl4RUREQqTgFRERCZGCV0REJEQKXhERkRApeEVEREKk4BUREQmRgldERCRECl4REZEQKXhFRERCpOAVEREJkYJXREQkRApeERGRECl4RUREQpRY0gUUZHfWfmoPfbekyzhsv2mSTa9irjt9ZJcj1teePXu45ZZbOP7448nOzqZbt24MHz48V5tvv/2WG2+8ke3bt7N//35GjhxJ586dycrKol+/fsyfP5/s7Gx69uzJvffey7p16+jZsyebNm0iISGBm266iUGDBgGwcOFC+vfvz549e0hMTOSvf/0r559/PgBpaWnccccdZGVlUaVKFWbMmFFoXy+88ALXX389VatWBeCRRx6hc+fOAIwYMYJnn32WMmXK8Pjjj3PZZZexatUqfvGLX0Qf11dffcVDDz3EHXfcEZ336KOPMmTIELZs2UKVKlXYtm0bffr04csvv6RcuXI899xzNG7cGICxY8cybtw43J1f//rX0X4WLVpE//79yczMpHbt2rz66qtUrFiRffv28cc//pHbbruNhIQExo4dS0pKCgCvv/46f/jDH9i/fz9dunRh1KhR0Zr+/ve/M2zYMMyMZs2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W9OrVC4i82Rg5ciTnnXdegX/P4hBbd7w4Vms2s3nu3vLIVCTFQR8nOsZt2bKFzMxMIHJU+a9//Yv69evnalOrVi2mT58OwIoVK9izZw9Vq1alVq1afPTRR7g7O3fuZNasWdSvXx93p2/fvjRo0CBXUAKcccYZzJgxA4CPPvqIs88+G4ArrriCTz/9lOzsbHbt2sUXX3xBgwYNCu1r69at0fuTJ0+OXm2cmprKxIkT2bt3L19//TVr1qyJXjkNMGHChFzDzE2aNGHz5s2kp6eTnp5OUlIS8+fP5/TTT2f79u3s27cPgPHjx9OmTZto6OZc6PTtt98yadKkaJ858w8cOMDDDz9M//79Adi1axe7d+8GYNq0aSQmJkZDN2edbdu28de//pV+/foBcOWVV/Lxxx8DkJGRwerVq6lbt25hf1IRKeVK7ceJJBzfffcdd955J/fddx8HDhyge/fudO3alQcffJCWLVuSmprKmDFj+PWvf82f//xnzIwXXngBM2PgwIH07t2bxo0b4+707t2bpk2b8tlnn/Hyyy/TpEkTmjdvDvz3oz7jxo1j0KBBZGdnU65cOZ555hkAGjRoQMeOHWnatCkJCQn069ePxo0bF9rX008/Hf2YTe3atXn66aeByBF69+7dadiwIYmJiTz55JOUKVMGiITftGnTom0PZcWKFfTs2ZMyZcrQsGFDnn322eiya665hq1bt3Lcccfx5JNPRi+AmjBhAk8++SQAV199Nb179wYi4XrzzTdToUIFatSowcsvvxzta9CgQSxatAiABx98kHPOOQeIHK1PnTqVhg0bUqZMGUaPHs2pp576E/7SIlJaFPtQM5FwnwtUBA4AmUBDd99R2Poaai5YcQ41x5N4rDsea4b4rPtYrVlDzaVfsSWEu9eOmUw63PVPOK4Mq45wwIQhLS2N9OtTSroMEREppXSOV0REJEQKXhERkRApeEVEREKk4BUREQmRgldERCRECl4REZEQKXhFRERCpOAVEREJkYJXREQkRApeERGRECl4RUREQqTgFRERCZGCV0REJEQKXhERkRApeEVEREKk4BUREQmRgldERCRECl4REZEQKXhFRERCpOAVEREJkYJXREQkRApeERGRECl4RUREQqTgF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r4vzgYpI6aPglWPRbndvXsjyOcBzwY9hvO3uC80sBfgkJyjdPeeHOi4CrgnmfWRmp5pZpWDZFHffHdy/FGhqZt2C6UrA2YCCV+QYo+AVycPdPwl+eq0L8LKZjQa2k/9PyBX2U3M787S7zd1L7AcQRKR00DlekTzM7Exgs7uPI/JLVC2Az4G2ZlYnaJMz1PwJcH0wLwXI8IN/nxkivzh0S3AUjZmdE/zajIgcY3TEK3KwFGCImWUBmUBPd98SnKedZGYJRH5btwMwDHjezBYDu/jvzwDmNR6oDcwPfsZwC3BlcT4IESmd9HEiERGREGmoWUREJEQKXhERkRApeEVEREKk4BUREQmRgldERCRECl4REZEQKXhFRERC9P8yjjosrvY2PAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_importance(model, importance_type='cover', title='Cover')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Weight (Frequence):** is the percentage representing the relative number of times a particular feature occurs in the trees of the model. Is the number of splits in which the particular feature occurred."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7f375406f7f0>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAEWCAYAAACOv5f1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAHFhJREFUeJzt3X+8VHW97/HXG7YigoIGFImIBCQqiKhRNw5CpimQ0pVjce2koZFlkaUlno5eqVPpPWlpefNiHsMf6TmaGdnvhO2v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gMl55YqI8yKiX0QMIHk8zY2Ik/POJambpD1azpPMYy8i599jRDwHPC3pvenQUcDjeeeqMIU3pnwg/1x/A94vaff0/2bLzyvXx9cO5f2iwzZeQBkPPEkyX/z1HHPcSDKHt4lkb+g0krniO4Cl6b9755BrNMlTyIXAI+lpfN7ZgOHAw2muRcAF6fhA4H7gKZKn6l1y/J2OBW4vQq50+39OT4+1PNbz/j2mGUYAC9Lf5W3AXgXJtTvwItCjYqwIuWYCT6SP++uALnk/vnZ08uEdzMxKqIjTPmZmljGXv5lZCbn8zcxKyOVvZlZCLn8zsxIq8he4m2VC0mbg0YqhSRHRlFMcs1z4rZ5WOpLWRkT3Om6vId44xotZIXjax6wVSX0l3ZUeM36RpH9Ix4+V9FD6fQV3pGN7S7pN0kJJ90kano5fKGmWpN8D16YHvPs3SQ+ky342x7to5mkfK6Wu6ZFHITkmy8daXf+/SA6/+630+yV2l9QbuAoYExHLJO2dLjsTeDgiJkn6EHAtyadjITnm/OiI2JAesfPliDhCUhfgXkm/j4hlWd5Rs21x+VsZbYjkyKPb8gDw7+nB826LiEckjQXuainriPh7uuxo4MR0bK6kd0jqkV43JyI2pOePAYZLajnWSw9gMMlx883qzuVv1kpE3JUeWnkCcJ2kfwNW0/Yhebd3aOh1rZb7YkT8rl3Dmr1FnvM3a0XSfiTH/7+K5OipI4H5wJGS9k+XaZn2uQs4OR0bC7wQbX+3wu+Az6XPJpA0JD2Sp1kuvOdvtrWxwFclbQLWAp+KiFXpvP2tkjqRHDP+aOBCkm+8WkjynbKntL1KfkzylaAPpYf9XQVMyvJOmG2P3+ppZlZCnvYxMyshl7+ZWQm5/M3MSsjlb2ZWQi5/M7MScvmbmZWQy9/MrIT+Pz4T04rqqEsEAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_importance(model, importance_type='weight', title='Weight (Frequence)')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In order to avoid overfitting, we can use the early stopping technique looking at the error on our local validation set. Let's try it:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train, X_val, y_train, y_val = train_test_split(X_train, y_train, test_size=0.2, random_state=3)\n",
    "\n",
    "dtrain = xgb.DMatrix(X_train, label=y_train)\n",
    "dval = xgb.DMatrix(X_val, label=y_val)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0]\ttrain-merror:0.020833\tvalidation-merror:0\n",
      "Multiple eval metrics have been passed: 'validation-merror' will be used for early stopping.\n",
      "\n",
      "Will train until validation-merror hasn't improved in 20 rounds.\n",
      "[2]\ttrain-merror:0.020833\tvalidation-merror:0\n",
      "[4]\ttrain-merror:0.020833\tvalidation-merror:0\n",
      "[6]\ttrain-merror:0.010417\tvalidation-merror:0.041667\n",
      "[8]\ttrain-merror:0.010417\tvalidation-merror:0.041667\n",
      "[10]\ttrain-merror:0\tvalidation-merror:0.083333\n",
      "[12]\ttrain-merror:0\tvalidation-merror:0.041667\n",
      "[14]\ttrain-merror:0\tvalidation-merror:0.083333\n",
      "[16]\ttrain-merror:0\tvalidation-merror:0.083333\n",
      "[18]\ttrain-merror:0\tvalidation-merror:0.083333\n",
      "[19]\ttrain-merror:0\tvalidation-merror:0.083333\n"
     ]
    }
   ],
   "source": [
    "model = xgb.train(params,\n",
    "                  dtrain,\n",
    "                  num_round,\n",
    "                  verbose_eval=2,\n",
    "                  evals=[(dtrain, 'train'), (dval, 'validation')],\n",
    "                  early_stopping_rounds=20)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### If we plot the precision and feature weight we may see changes in the values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Precision: 0.95 %\n"
     ]
    }
   ],
   "source": [
    "preds = model.predict(dtest)\n",
    "best_preds = np.asarray([np.argmax(line) for line in preds])\n",
    "print(\"Precision: {:.2f} %\".format(precision_score(y_test, best_preds, average='macro')))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7f374ffcf780>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAEWCAYAAACOv5f1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAG4lJREFUeJzt3X+8VHW97/HXG7cSgoAGKImAiAIqSGqHemQIlSZiXi2PJ66dVDR/ZJI3rYOno1frVFp5U9OrF+v4K3+cY2milWXKVuNqCsovQ8SOu6P5C0xEEHWDn/PHWhuH7d7s2bTXnjV+38/HYx7MfGfNWu/Zj+E9a74zs0YRgZmZpaVHrQOYmVn3c/mbmSXI5W9mliCXv5lZglz+ZmYJcvmbmSXI5W+lJOlKSedUuew1kv71b9zeQEnLJL3vb1nPe4GkGZIuqHUOK5bL37qEpLMl/arV2PJ2xj7X0foi4pSI+FYXZQtJIztYbCZwdUS8kd+mUdIbktZUnD7SFXnqwCzg85IG1TqIFcflb13lfuCjkrYCkLQTsDWwb6uxkfmypSGpJ3As8NNWV305IvpUnB5s47YN3RKyG+VPgL8GvlDrLFYcl791lUfIyn58fnkiMAdY1mrsTxHxHICk0ZLulvTXfMrl6JaVtZ7KkfR1Sc9Lek7SiW3szW8v6ZeSXpP0B0m75bdreaJZmO+9/0Mb2ScAqyLi2WruaL7t0yQtB5ZXcV/eL2m2p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pqBNcAXImJFPm9/q6QeZMdqPwg4j+zXpxaR/ZbrsW2vkh+T/fzno/nhtlcARxR5J8w2xx/1NDNLkKd9zMwS5PI3M0uQy9/MLEEufzOzBLn8zcwS5PI3M0uQy9/MLEH/DXoNAeAUMph+AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_importance(model, importance_type='weight', title='Weight (Frequence)')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## How to use XGBoost in RecSys?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Hint: reranking and hybridization\n",
    "\n",
    "### Steps:\n",
    "* Run your best algorithm and select a number of recommendations higher than the target cutoff, for example if you have to compute MAP@10, get 20 recommendations\n",
    "* Build a dataframe whose samples are the user-item recommendations\n",
    "* Add for each interaction some content features: item features, user features\n",
    "* Add for each interaction some features derived by other algorithms: CBF prediction, hybrid prediction\n",
    "* Add for each interaction other miscellaneous information: profile length, item popularity .."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Dummy example"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "from urllib.request import urlretrieve\n",
    "import zipfile\n",
    "\n",
    "# skip the download\n",
    "#urlretrieve (\"http://files.grouplens.org/datasets/movielens/ml-10m.zip\", \"movielens_10m.zip\")\n",
    "dataFile = zipfile.ZipFile(\"movielens_10m.zip\")\n",
    "URM_path = dataFile.extract(\"ml-10M100K/ratings.dat\")\n",
    "URM_file = open(URM_path, 'r')\n",
    "\n",
    "\n",
    "def rowSplit (rowString):\n",
    "    \n",
    "    split = rowString.split(\"::\")\n",
    "    split[3] = split[3].replace(\"\\n\",\"\")\n",
    "    \n",
    "    split[0] = int(split[0])\n",
    "    split[1] = int(split[1])\n",
    "    split[2] = float(split[2])\n",
    "    split[3] = int(split[3])\n",
    "    \n",
    "    result = tuple(split)\n",
    "    \n",
    "    return result\n",
    "\n",
    "\n",
    "URM_file.seek(0)\n",
    "URM_tuples = []\n",
    "\n",
    "for line in URM_file:\n",
    "   URM_tuples.append(rowSplit (line))\n",
    "\n",
    "userList, itemList, ratingList, timestampList = zip(*URM_tuples)\n",
    "\n",
    "userList = list(userList)\n",
    "itemList = list(itemList)\n",
    "ratingList = list(ratingList)\n",
    "timestampList = list(timestampList)\n",
    "\n",
    "import scipy.sparse as sps\n",
    "\n",
    "URM_all = sps.coo_matrix((ratingList, (userList, itemList)))\n",
    "URM_all = URM_all.tocsr()\n",
    "\n",
    "\n",
    "\n",
    "from data_splitter import train_test_holdout\n",
    "\n",
    "\n",
    "URM_train, URM_test = train_test_holdout(URM_all, train_perc = 0.8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of items\t 7601, Number of users\t 4009\n",
      "Number of tags\t 16529, Number of item-tag tuples 95580\n",
      "\n",
      "Data example:\n",
      "[15, 20, 20, 20, 20, 20, 20, 20, 20, 20]\n",
      "[4973, 1747, 1747, 2424, 2424, 2424, 2947, 2947, 3033, 3033]\n",
      "['excellent!', 'politics', 'satire', 'chick flick 212', 'hanks', 'ryan', 'action', 'bond', 'spoof', 'star wars']\n"
     ]
    }
   ],
   "source": [
    "ICM_path = dataFile.extract(\"ml-10M100K/tags.dat\", path = \"data/Movielens_10M\")\n",
    "ICM_file = open(ICM_path, 'r')\n",
    "\n",
    "def rowSplit (rowString):\n",
    "    split = rowString.split(\"::\")\n",
    "    split[3] = split[3].replace(\"\\n\",\"\")\n",
    "    \n",
    "    split[0] = int(split[0])\n",
    "    split[1] = int(split[1])\n",
    "    split[2] = str(split[2]) # tag is a string, not a float like the rating\n",
    "    split[3] = int(split[3])\n",
    "    \n",
    "    result = tuple(split)\n",
    "    \n",
    "    return result\n",
    "\n",
    "ICM_file.seek(0)\n",
    "ICM_tuples = []\n",
    "\n",
    "for line in ICM_file:\n",
    "    ICM_tuples.append(rowSplit(line))\n",
    "    \n",
    "userList_icm, itemList_icm, tagList_icm, timestampList_icm = zip(*ICM_tuples)\n",
    "\n",
    "userList_icm = list(userList_icm)\n",
    "itemList_icm = list(itemList_icm)\n",
    "tagList_icm = list(tagList_icm)\n",
    "timestampList_icm = list(timestampList_icm)\n",
    "\n",
    "userList_unique = list(set(userList_icm))\n",
    "itemList_unique = list(set(itemList_icm))\n",
    "tagList_unique = list(set(tagList_icm))\n",
    "\n",
    "numUsers = len(userList_unique)\n",
    "numItems = len(itemList_unique)\n",
    "numTags = len(tagList_unique)\n",
    "\n",
    "\n",
    "print (\"Number of items\\t {}, Number of users\\t {}\".format(numItems, numUsers))\n",
    "print (\"Number of tags\\t {}, Number of item-tag tuples {}\".format(numTags, len(tagList_icm)))\n",
    "\n",
    "print(\"\\nData example:\")\n",
    "print(userList_icm[0:10])\n",
    "print(itemList_icm[0:10])\n",
    "print(tagList_icm[0:10])\n",
    "\n",
    "\n",
    "from sklearn import preprocessing\n",
    "le = preprocessing.LabelEncoder()\n",
    "le.fit(tagList_icm)\n",
    "\n",
    "tagList_icm = le.transform(tagList_icm)\n",
    "\n",
    "import numpy as np\n",
    "\n",
    "ones = np.ones(len(tagList_icm))\n",
    "\n",
    "ICM_all = sps.coo_matrix((ones, (itemList_icm, tagList_icm)), shape=(URM_all.shape[1], tagList_icm.max()+1))\n",
    "ICM_all = ICM_all.tocsr()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "class MyBestHybrid_Recommender(object):\n",
    "    \n",
    "    def __init__(self, URM):\n",
    "        \n",
    "        self.URM = URM\n",
    "        self.n_users, self.n_items = URM.shape\n",
    "        \n",
    "        \n",
    "    def fit(self):\n",
    "        pass\n",
    "    \n",
    "    def recommend(self, user_id, cutoff = 5, exclude_seen=True):\n",
    "        \n",
    "        user_profile = self.URM[user_id]\n",
    "        \n",
    "        ranking = np.random.choice(self.n_items, cutoff)\n",
    "            \n",
    "        return ranking\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "n_users, n_items = URM_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "dummyHybridRecommender = MyBestHybrid_Recommender(URM_train)\n",
    "dummyHybridRecommender.fit()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Build the dataframe with the predictions\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "cutoff = 20\n",
    "user_recommendations_items = []\n",
    "user_recommendations_user_id = []\n",
    "\n",
    "for n_user in range(100):\n",
    "    \n",
    "    recommendations = dummyHybridRecommender.recommend(n_user, cutoff = 20)\n",
    "    \n",
    "    user_recommendations_items.extend(recommendations)\n",
    "    user_recommendations_user_id.extend([n_user]*len(recommendations))\n",
    "    \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[53639,\n",
       " 10643,\n",
       " 20615,\n",
       " 5706,\n",
       " 39938,\n",
       " 52052,\n",
       " 488,\n",
       " 16342,\n",
       " 23523,\n",
       " 38284,\n",
       " 13809,\n",
       " 42227,\n",
       " 26351,\n",
       " 31157,\n",
       " 59947,\n",
       " 64169,\n",
       " 40624,\n",
       " 55150,\n",
       " 31262,\n",
       " 15222,\n",
       " 36138,\n",
       " 54264,\n",
       " 21625,\n",
       " 59519,\n",
       " 25389,\n",
       " 44537,\n",
       " 49690,\n",
       " 32351,\n",
       " 20547,\n",
       " 38629,\n",
       " 59107,\n",
       " 57897,\n",
       " 49923,\n",
       " 44204,\n",
       " 37193,\n",
       " 45808,\n",
       " 33397,\n",
       " 44330,\n",
       " 36206,\n",
       " 31101,\n",
       " 27697,\n",
       " 48163,\n",
       " 51181,\n",
       " 17255,\n",
       " 11580,\n",
       " 51042,\n",
       " 51841,\n",
       " 36011,\n",
       " 135,\n",
       " 52054,\n",
       " 40049,\n",
       " 28054,\n",
       " 49409,\n",
       " 36178,\n",
       " 8057,\n",
       " 58374,\n",
       " 35126,\n",
       " 17436,\n",
       " 9151,\n",
       " 49826,\n",
       " 32170,\n",
       " 38846,\n",
       " 55358,\n",
       " 56793,\n",
       " 17952,\n",
       " 43513,\n",
       " 6871,\n",
       " 23124,\n",
       " 56277,\n",
       " 34882,\n",
       " 33599,\n",
       " 57798,\n",
       " 29715,\n",
       " 26327,\n",
       " 63377,\n",
       " 44346,\n",
       " 15161,\n",
       " 62598,\n",
       " 62724,\n",
       " 60546,\n",
       " 32728,\n",
       " 12877,\n",
       " 37019,\n",
       " 13379,\n",
       " 34954,\n",
       " 22116,\n",
       " 3089,\n",
       " 16088,\n",
       " 15778,\n",
       " 55515,\n",
       " 13692,\n",
       " 32284,\n",
       " 47187,\n",
       " 47392,\n",
       " 55891,\n",
       " 29206,\n",
       " 20297,\n",
       " 11362,\n",
       " 28873,\n",
       " 45383,\n",
       " 42631,\n",
       " 7921,\n",
       " 24678,\n",
       " 3241,\n",
       " 9200,\n",
       " 32692,\n",
       " 56627,\n",
       " 20790,\n",
       " 13315,\n",
       " 27369,\n",
       " 360,\n",
       " 16236,\n",
       " 41707,\n",
       " 8476,\n",
       " 47476,\n",
       " 8068,\n",
       " 51608,\n",
       " 61376,\n",
       " 11911,\n",
       " 56830,\n",
       " 45844,\n",
       " 18629,\n",
       " 22274,\n",
       " 32543,\n",
       " 31621,\n",
       " 11089,\n",
       " 39445,\n",
       " 62818,\n",
       " 29125,\n",
       " 59146,\n",
       " 55904,\n",
       " 26399,\n",
       " 31230,\n",
       " 49684,\n",
       " 32397,\n",
       " 2208,\n",
       " 40302,\n",
       " 25334,\n",
       " 43476,\n",
       " 21411,\n",
       " 44100,\n",
       " 1841,\n",
       " 40604,\n",
       " 53299,\n",
       " 23733,\n",
       " 13280,\n",
       " 4624,\n",
       " 19122,\n",
       " 18681,\n",
       " 44096,\n",
       " 28502,\n",
       " 850,\n",
       " 23313,\n",
       " 41519,\n",
       " 30225,\n",
       " 24648,\n",
       " 50518,\n",
       " 63730,\n",
       " 61503,\n",
       " 53061,\n",
       " 290,\n",
       " 22664,\n",
       " 37258,\n",
       " 1565,\n",
       " 37313,\n",
       " 41486,\n",
       " 24044,\n",
       " 11469,\n",
       " 52028,\n",
       " 27997,\n",
       " 44904,\n",
       " 14900,\n",
       " 4613,\n",
       " 20951,\n",
       " 23060,\n",
       " 58145,\n",
       " 25895,\n",
       " 63332,\n",
       " 44799,\n",
       " 20604,\n",
       " 41358,\n",
       " 28498,\n",
       " 32815,\n",
       " 46475,\n",
       " 36409,\n",
       " 46738,\n",
       " 56985,\n",
       " 3890,\n",
       " 30227,\n",
       " 21310,\n",
       " 56853,\n",
       " 16899,\n",
       " 5448,\n",
       " 39212,\n",
       " 65125,\n",
       " 62351,\n",
       " 43275,\n",
       " 19402,\n",
       " 46888,\n",
       " 57089,\n",
       " 56641,\n",
       " 11059,\n",
       " 45201,\n",
       " 63766,\n",
       " 5297,\n",
       " 1109,\n",
       " 42951,\n",
       " 22483,\n",
       " 31206,\n",
       " 16495,\n",
       " 58285,\n",
       " 43055,\n",
       " 30583,\n",
       " 1529,\n",
       " 62027,\n",
       " 63888,\n",
       " 42583,\n",
       " 45759,\n",
       " 54601,\n",
       " 3568,\n",
       " 18885,\n",
       " 37000,\n",
       " 54998,\n",
       " 26641,\n",
       " 11914,\n",
       " 48712,\n",
       " 838,\n",
       " 60390,\n",
       " 23018,\n",
       " 47898,\n",
       " 45253,\n",
       " 32954,\n",
       " 21729,\n",
       " 44179,\n",
       " 28585,\n",
       " 42948,\n",
       " 9539,\n",
       " 27022,\n",
       " 42869,\n",
       " 19540,\n",
       " 15333,\n",
       " 35943,\n",
       " 41017,\n",
       " 13461,\n",
       " 39479,\n",
       " 24930,\n",
       " 23187,\n",
       " 45435,\n",
       " 3604,\n",
       " 37577,\n",
       " 32098,\n",
       " 51856,\n",
       " 31079,\n",
       " 43800,\n",
       " 53809,\n",
       " 43282,\n",
       " 31451,\n",
       " 40270,\n",
       " 59944,\n",
       " 10812,\n",
       " 17773,\n",
       " 16150,\n",
       " 42499,\n",
       " 59401,\n",
       " 54930,\n",
       " 47485,\n",
       " 46573,\n",
       " 26884,\n",
       " 49109,\n",
       " 58345,\n",
       " 45657,\n",
       " 35348,\n",
       " 29506,\n",
       " 48861,\n",
       " 48318,\n",
       " 61072,\n",
       " 58539,\n",
       " 23372,\n",
       " 56767,\n",
       " 3071,\n",
       " 42514,\n",
       " 14789,\n",
       " 22673,\n",
       " 41363,\n",
       " 60362,\n",
       " 37430,\n",
       " 39230,\n",
       " 16403,\n",
       " 33202,\n",
       " 21467,\n",
       " 24331,\n",
       " 21316,\n",
       " 3409,\n",
       " 17686,\n",
       " 25638,\n",
       " 14083,\n",
       " 58466,\n",
       " 50497,\n",
       " 37854,\n",
       " 64251,\n",
       " 34788,\n",
       " 27518,\n",
       " 47446,\n",
       " 18936,\n",
       " 61077,\n",
       " 29451,\n",
       " 11676,\n",
       " 27770,\n",
       " 62803,\n",
       " 13360,\n",
       " 46377,\n",
       " 26865,\n",
       " 20831,\n",
       " 64613,\n",
       " 51806,\n",
       " 18286,\n",
       " 14532,\n",
       " 7702,\n",
       " 38057,\n",
       " 48723,\n",
       " 22916,\n",
       " 59952,\n",
       " 39107,\n",
       " 21435,\n",
       " 18781,\n",
       " 5520,\n",
       " 2435,\n",
       " 49680,\n",
       " 10183,\n",
       " 32868,\n",
       " 2946,\n",
       " 25168,\n",
       " 63636,\n",
       " 52566,\n",
       " 6564,\n",
       " 25525,\n",
       " 31367,\n",
       " 40625,\n",
       " 34061,\n",
       " 26293,\n",
       " 23188,\n",
       " 959,\n",
       " 24546,\n",
       " 26015,\n",
       " 31535,\n",
       " 37964,\n",
       " 4384,\n",
       " 62285,\n",
       " 62098,\n",
       " 63149,\n",
       " 4971,\n",
       " 25500,\n",
       " 57479,\n",
       " 50352,\n",
       " 62429,\n",
       " 62898,\n",
       " 44012,\n",
       " 5706,\n",
       " 59314,\n",
       " 50856,\n",
       " 62769,\n",
       " 7730,\n",
       " 58773,\n",
       " 25505,\n",
       " 39368,\n",
       " 7170,\n",
       " 40803,\n",
       " 14564,\n",
       " 42526,\n",
       " 59715,\n",
       " 9124,\n",
       " 18837,\n",
       " 27712,\n",
       " 61644,\n",
       " 13557,\n",
       " 29510,\n",
       " 60251,\n",
       " 4257,\n",
       " 46499,\n",
       " 50960,\n",
       " 51759,\n",
       " 5119,\n",
       " 19256,\n",
       " 3739,\n",
       " 11999,\n",
       " 17081,\n",
       " 9055,\n",
       " 61691,\n",
       " 38701,\n",
       " 2661,\n",
       " 17964,\n",
       " 34202,\n",
       " 28092,\n",
       " 7272,\n",
       " 63478,\n",
       " 23176,\n",
       " 51565,\n",
       " 32464,\n",
       " 61010,\n",
       " 33814,\n",
       " 24522,\n",
       " 53113,\n",
       " 18214,\n",
       " 41838,\n",
       " 28960,\n",
       " 26841,\n",
       " 35643,\n",
       " 34355,\n",
       " 2092,\n",
       " 22758,\n",
       " 17978,\n",
       " 18922,\n",
       " 49079,\n",
       " 34988,\n",
       " 40367,\n",
       " 28170,\n",
       " 22136,\n",
       " 37544,\n",
       " 38248,\n",
       " 59507,\n",
       " 21814,\n",
       " 52144,\n",
       " 58159,\n",
       " 13121,\n",
       " 10580,\n",
       " 1775,\n",
       " 46112,\n",
       " 45448,\n",
       " 58304,\n",
       " 3605,\n",
       " 13439,\n",
       " 27448,\n",
       " 59995,\n",
       " 17197,\n",
       " 54876,\n",
       " 26856,\n",
       " 38408,\n",
       " 26397,\n",
       " 14415,\n",
       " 40498,\n",
       " 49495,\n",
       " 47806,\n",
       " 7613,\n",
       " 43827,\n",
       " 9450,\n",
       " 48128,\n",
       " 42587,\n",
       " 64292,\n",
       " 56515,\n",
       " 21946,\n",
       " 36889,\n",
       " 41626,\n",
       " 15681,\n",
       " 2944,\n",
       " 19919,\n",
       " 45768,\n",
       " 58356,\n",
       " 18371,\n",
       " 15340,\n",
       " 21367,\n",
       " 46213,\n",
       " 24618,\n",
       " 31858,\n",
       " 3362,\n",
       " 35980,\n",
       " 19217,\n",
       " 32491,\n",
       " 44327,\n",
       " 38621,\n",
       " 50545,\n",
       " 36148,\n",
       " 29520,\n",
       " 30504,\n",
       " 7949,\n",
       " 37729,\n",
       " 17855,\n",
       " 13248,\n",
       " 28322,\n",
       " 39694,\n",
       " 39634,\n",
       " 61439,\n",
       " 23324,\n",
       " 41360,\n",
       " 30438,\n",
       " 51688,\n",
       " 50212,\n",
       " 20258,\n",
       " 44473,\n",
       " 12580,\n",
       " 18281,\n",
       " 38643,\n",
       " 11511,\n",
       " 57900,\n",
       " 14306,\n",
       " 30893,\n",
       " 33316,\n",
       " 36015,\n",
       " 51529,\n",
       " 25705,\n",
       " 60662,\n",
       " 48718,\n",
       " 46908,\n",
       " 43835,\n",
       " 39020,\n",
       " 61034,\n",
       " 31429,\n",
       " 64261,\n",
       " 51407,\n",
       " 54636,\n",
       " 48112,\n",
       " 47790,\n",
       " 52252,\n",
       " 11474,\n",
       " 12493,\n",
       " 24756,\n",
       " 42784,\n",
       " 20255,\n",
       " 34389,\n",
       " 42926,\n",
       " 17067,\n",
       " 38106,\n",
       " 34587,\n",
       " 49192,\n",
       " 20211,\n",
       " 3266,\n",
       " 14354,\n",
       " 60689,\n",
       " 33602,\n",
       " 49972,\n",
       " 246,\n",
       " 19240,\n",
       " 54354,\n",
       " 60589,\n",
       " 40463,\n",
       " 58857,\n",
       " 53799,\n",
       " 5189,\n",
       " 29338,\n",
       " 24645,\n",
       " 31244,\n",
       " 51530,\n",
       " 54186,\n",
       " 23289,\n",
       " 5297,\n",
       " 3398,\n",
       " 15542,\n",
       " 28468,\n",
       " 22535,\n",
       " 7765,\n",
       " 15158,\n",
       " 10470,\n",
       " 1262,\n",
       " 44253,\n",
       " 13891,\n",
       " 16761,\n",
       " 42337,\n",
       " 14370,\n",
       " 33206,\n",
       " 19308,\n",
       " 21245,\n",
       " 1733,\n",
       " 40700,\n",
       " 1642,\n",
       " 63981,\n",
       " 16436,\n",
       " 1572,\n",
       " 44771,\n",
       " 40294,\n",
       " 56063,\n",
       " 713,\n",
       " 1305,\n",
       " 42010,\n",
       " 77,\n",
       " 57197,\n",
       " 62689,\n",
       " 63496,\n",
       " 44546,\n",
       " 9925,\n",
       " 60537,\n",
       " 12176,\n",
       " 35500,\n",
       " 24224,\n",
       " 27746,\n",
       " 31102,\n",
       " 34124,\n",
       " 1594,\n",
       " 37120,\n",
       " 38188,\n",
       " 43754,\n",
       " 12059,\n",
       " 59186,\n",
       " 55287,\n",
       " 12423,\n",
       " 57575,\n",
       " 54737,\n",
       " 64769,\n",
       " 2194,\n",
       " 43619,\n",
       " 23982,\n",
       " 22321,\n",
       " 63645,\n",
       " 41741,\n",
       " 49917,\n",
       " 13274,\n",
       " 7052,\n",
       " 33250,\n",
       " 46979,\n",
       " 61973,\n",
       " 21426,\n",
       " 30580,\n",
       " 58140,\n",
       " 35172,\n",
       " 8250,\n",
       " 64680,\n",
       " 17664,\n",
       " 34931,\n",
       " 38367,\n",
       " 23339,\n",
       " 46528,\n",
       " 62013,\n",
       " 31957,\n",
       " 21259,\n",
       " 55282,\n",
       " 18931,\n",
       " 5177,\n",
       " 32558,\n",
       " 35369,\n",
       " 50103,\n",
       " 6755,\n",
       " 39356,\n",
       " 1866,\n",
       " 56448,\n",
       " 31631,\n",
       " 55411,\n",
       " 39156,\n",
       " 2986,\n",
       " 45020,\n",
       " 57424,\n",
       " 48536,\n",
       " 33339,\n",
       " 19116,\n",
       " 50913,\n",
       " 58525,\n",
       " 62438,\n",
       " 38762,\n",
       " 29512,\n",
       " 12117,\n",
       " 32810,\n",
       " 31237,\n",
       " 12227,\n",
       " 7018,\n",
       " 17000,\n",
       " 17338,\n",
       " 15548,\n",
       " 15466,\n",
       " 7962,\n",
       " 7639,\n",
       " 2078,\n",
       " 50485,\n",
       " 15432,\n",
       " 0,\n",
       " 44280,\n",
       " 40690,\n",
       " 32094,\n",
       " 55253,\n",
       " 7560,\n",
       " 52722,\n",
       " 51727,\n",
       " 45299,\n",
       " 11537,\n",
       " 12766,\n",
       " 42506,\n",
       " 31178,\n",
       " 25304,\n",
       " 40179,\n",
       " 21835,\n",
       " 57308,\n",
       " 2979,\n",
       " 33951,\n",
       " 53576,\n",
       " 3874,\n",
       " 52236,\n",
       " 4727,\n",
       " 3148,\n",
       " 4252,\n",
       " 63083,\n",
       " 52118,\n",
       " 11675,\n",
       " 17589,\n",
       " 16438,\n",
       " 28882,\n",
       " 14715,\n",
       " 36520,\n",
       " 44469,\n",
       " 40274,\n",
       " 10172,\n",
       " 61714,\n",
       " 27650,\n",
       " 3970,\n",
       " 32011,\n",
       " 45785,\n",
       " 53725,\n",
       " 1978,\n",
       " 22058,\n",
       " 56789,\n",
       " 36197,\n",
       " 8185,\n",
       " 45385,\n",
       " 35120,\n",
       " 2447,\n",
       " 18117,\n",
       " 31528,\n",
       " 13240,\n",
       " 3248,\n",
       " 18008,\n",
       " 37062,\n",
       " 10443,\n",
       " 39580,\n",
       " 33753,\n",
       " 30452,\n",
       " 29792,\n",
       " 27220,\n",
       " 19191,\n",
       " 56839,\n",
       " 23527,\n",
       " 25681,\n",
       " 60098,\n",
       " 5744,\n",
       " 51815,\n",
       " 21567,\n",
       " 34144,\n",
       " 28798,\n",
       " 56649,\n",
       " 39555,\n",
       " 51192,\n",
       " 58450,\n",
       " 57359,\n",
       " 33688,\n",
       " 34611,\n",
       " 2247,\n",
       " 46282,\n",
       " 35481,\n",
       " 52979,\n",
       " 22874,\n",
       " 24694,\n",
       " 58456,\n",
       " 48095,\n",
       " 47393,\n",
       " 17888,\n",
       " 10006,\n",
       " 16058,\n",
       " 11247,\n",
       " 60319,\n",
       " 60913,\n",
       " 47496,\n",
       " 10838,\n",
       " 13622,\n",
       " 13359,\n",
       " 58310,\n",
       " 31014,\n",
       " 15153,\n",
       " 39492,\n",
       " 13525,\n",
       " 61984,\n",
       " 27782,\n",
       " 4959,\n",
       " 12880,\n",
       " 55022,\n",
       " 37472,\n",
       " 41598,\n",
       " 25445,\n",
       " 33524,\n",
       " 43310,\n",
       " 25894,\n",
       " 18101,\n",
       " 9446,\n",
       " 20640,\n",
       " 53495,\n",
       " 33363,\n",
       " 23977,\n",
       " 21425,\n",
       " 21392,\n",
       " 41915,\n",
       " 61459,\n",
       " 48277,\n",
       " 43988,\n",
       " 21802,\n",
       " 53983,\n",
       " 54657,\n",
       " 20250,\n",
       " 40416,\n",
       " 31119,\n",
       " 60513,\n",
       " 6703,\n",
       " 406,\n",
       " 1914,\n",
       " 56639,\n",
       " 43917,\n",
       " 27667,\n",
       " 59046,\n",
       " 19855,\n",
       " 48498,\n",
       " 46910,\n",
       " 8558,\n",
       " 36136,\n",
       " 35987,\n",
       " 38165,\n",
       " 19666,\n",
       " 39096,\n",
       " 63964,\n",
       " 59171,\n",
       " 16252,\n",
       " 29152,\n",
       " 27599,\n",
       " 36396,\n",
       " 23308,\n",
       " 38751,\n",
       " 6409,\n",
       " 57183,\n",
       " 63345,\n",
       " 24750,\n",
       " 56601,\n",
       " 50280,\n",
       " 1351,\n",
       " 7919,\n",
       " 57243,\n",
       " 19848,\n",
       " 58585,\n",
       " 53529,\n",
       " 5372,\n",
       " 16901,\n",
       " 34295,\n",
       " 27585,\n",
       " 40230,\n",
       " 16835,\n",
       " 20478,\n",
       " 36600,\n",
       " 32822,\n",
       " 15073,\n",
       " 51003,\n",
       " 31900,\n",
       " 61979,\n",
       " 43671,\n",
       " 8375,\n",
       " 32239,\n",
       " 12551,\n",
       " 55005,\n",
       " 35774,\n",
       " 59209,\n",
       " 49042,\n",
       " 8576,\n",
       " 19065,\n",
       " 32863,\n",
       " 56763,\n",
       " 54983,\n",
       " 57601,\n",
       " 56948,\n",
       " 32567,\n",
       " 18774,\n",
       " 44361,\n",
       " 1299,\n",
       " 41350,\n",
       " 5733,\n",
       " 42288,\n",
       " 61869,\n",
       " 26577,\n",
       " 8510,\n",
       " 28826,\n",
       " 51433,\n",
       " 17397,\n",
       " 41221,\n",
       " 13808,\n",
       " 17050,\n",
       " 51926,\n",
       " 23237,\n",
       " 37679,\n",
       " 63646,\n",
       " 38401,\n",
       " 1098,\n",
       " 22836,\n",
       " 50390,\n",
       " 12451,\n",
       " 64076,\n",
       " 45585,\n",
       " 64565,\n",
       " 18283,\n",
       " 52550,\n",
       " 21393,\n",
       " 65000,\n",
       " 40031,\n",
       " 9026,\n",
       " 21776,\n",
       " 59267,\n",
       " 34101,\n",
       " 1725,\n",
       " 3269,\n",
       " 31535,\n",
       " 17667,\n",
       " 18568,\n",
       " 47321,\n",
       " 27818,\n",
       " 24730,\n",
       " 4604,\n",
       " 17658,\n",
       " 6093,\n",
       " 22688,\n",
       " 22567,\n",
       " 23737,\n",
       " 7946,\n",
       " 9031,\n",
       " 25934,\n",
       " 35090,\n",
       " 31791,\n",
       " 26483,\n",
       " 4434,\n",
       " 38039,\n",
       " 51486,\n",
       " 48023,\n",
       " 32366,\n",
       " 60369,\n",
       " 16132,\n",
       " 14351,\n",
       " 51017,\n",
       " 52324,\n",
       " 39444,\n",
       " 34140,\n",
       " 11189,\n",
       " 18891,\n",
       " 41741,\n",
       " 1172,\n",
       " 23607,\n",
       " 65064,\n",
       " 58633,\n",
       " 35536,\n",
       " 33869,\n",
       " 13695,\n",
       " 42696,\n",
       " 6955,\n",
       " 1628,\n",
       " 62838,\n",
       " 33311,\n",
       " 25819,\n",
       " 11626,\n",
       " 60595,\n",
       " 49225,\n",
       " 36615,\n",
       " 14002,\n",
       " 24159,\n",
       " 60977,\n",
       " 39780,\n",
       " 33944,\n",
       " 58821,\n",
       " 43607,\n",
       " 48907,\n",
       " 51508,\n",
       " 2563,\n",
       " 7074,\n",
       " 27593,\n",
       " 20630,\n",
       " 53157,\n",
       " 34579,\n",
       " 49609,\n",
       " 10613,\n",
       " 22204,\n",
       " 35427,\n",
       " 52718,\n",
       " 54921,\n",
       " 18880,\n",
       " 34449,\n",
       " 9557,\n",
       " 46200,\n",
       " 61151,\n",
       " 7814,\n",
       " 10208,\n",
       " 40783,\n",
       " 34307,\n",
       " 39088,\n",
       " 8306,\n",
       " 44151,\n",
       " 62936,\n",
       " 7429,\n",
       " 19094,\n",
       " 17994,\n",
       " 61840,\n",
       " 11434,\n",
       " 33581,\n",
       " 46431,\n",
       " 18798,\n",
       " 63528,\n",
       " 3266,\n",
       " 19526,\n",
       " 58325,\n",
       " 46714,\n",
       " 50159,\n",
       " 36240,\n",
       " 35882,\n",
       " 10628,\n",
       " 9575,\n",
       " 64485,\n",
       " 61997,\n",
       " ...]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "user_recommendations_items"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 0,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 1,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 2,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 3,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 4,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 5,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 6,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 7,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 8,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 9,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 10,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 11,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 12,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 13,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 14,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 15,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 16,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 17,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 18,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 19,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 20,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 21,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 22,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 23,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 24,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 25,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 26,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 27,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 28,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 29,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 30,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 31,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 32,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 33,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 34,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 35,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 36,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 37,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 38,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 39,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 40,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 41,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 42,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 43,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 44,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 45,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 46,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 47,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 48,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " 49,\n",
       " ...]"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "user_recommendations_user_id"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>item_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>53639</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>10643</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>20615</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>5706</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>39938</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0</td>\n",
       "      <td>52052</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0</td>\n",
       "      <td>488</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0</td>\n",
       "      <td>16342</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>0</td>\n",
       "      <td>23523</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0</td>\n",
       "      <td>38284</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>0</td>\n",
       "      <td>13809</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>0</td>\n",
       "      <td>42227</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>0</td>\n",
       "      <td>26351</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>0</td>\n",
       "      <td>31157</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>0</td>\n",
       "      <td>59947</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>0</td>\n",
       "      <td>64169</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>0</td>\n",
       "      <td>40624</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>0</td>\n",
       "      <td>55150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>0</td>\n",
       "      <td>31262</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>0</td>\n",
       "      <td>15222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>1</td>\n",
       "      <td>36138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>1</td>\n",
       "      <td>54264</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>1</td>\n",
       "      <td>21625</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>1</td>\n",
       "      <td>59519</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>1</td>\n",
       "      <td>25389</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>1</td>\n",
       "      <td>44537</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>1</td>\n",
       "      <td>49690</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>1</td>\n",
       "      <td>32351</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>1</td>\n",
       "      <td>20547</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>1</td>\n",
       "      <td>38629</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970</th>\n",
       "      <td>98</td>\n",
       "      <td>47896</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1971</th>\n",
       "      <td>98</td>\n",
       "      <td>6286</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1972</th>\n",
       "      <td>98</td>\n",
       "      <td>24001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1973</th>\n",
       "      <td>98</td>\n",
       "      <td>62207</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1974</th>\n",
       "      <td>98</td>\n",
       "      <td>6839</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1975</th>\n",
       "      <td>98</td>\n",
       "      <td>63645</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1976</th>\n",
       "      <td>98</td>\n",
       "      <td>17491</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1977</th>\n",
       "      <td>98</td>\n",
       "      <td>7158</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1978</th>\n",
       "      <td>98</td>\n",
       "      <td>37085</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1979</th>\n",
       "      <td>98</td>\n",
       "      <td>35586</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980</th>\n",
       "      <td>99</td>\n",
       "      <td>14035</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981</th>\n",
       "      <td>99</td>\n",
       "      <td>47121</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1982</th>\n",
       "      <td>99</td>\n",
       "      <td>39555</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1983</th>\n",
       "      <td>99</td>\n",
       "      <td>30216</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1984</th>\n",
       "      <td>99</td>\n",
       "      <td>55830</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1985</th>\n",
       "      <td>99</td>\n",
       "      <td>21924</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1986</th>\n",
       "      <td>99</td>\n",
       "      <td>35114</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1987</th>\n",
       "      <td>99</td>\n",
       "      <td>15421</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1988</th>\n",
       "      <td>99</td>\n",
       "      <td>36699</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1989</th>\n",
       "      <td>99</td>\n",
       "      <td>5022</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990</th>\n",
       "      <td>99</td>\n",
       "      <td>32555</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1991</th>\n",
       "      <td>99</td>\n",
       "      <td>29143</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1992</th>\n",
       "      <td>99</td>\n",
       "      <td>24740</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1993</th>\n",
       "      <td>99</td>\n",
       "      <td>6845</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1994</th>\n",
       "      <td>99</td>\n",
       "      <td>58348</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1995</th>\n",
       "      <td>99</td>\n",
       "      <td>54151</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1996</th>\n",
       "      <td>99</td>\n",
       "      <td>12884</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1997</th>\n",
       "      <td>99</td>\n",
       "      <td>38679</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1998</th>\n",
       "      <td>99</td>\n",
       "      <td>33084</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1999</th>\n",
       "      <td>99</td>\n",
       "      <td>27332</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2000 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      user_id  item_id\n",
       "0           0    53639\n",
       "1           0    10643\n",
       "2           0    20615\n",
       "3           0     5706\n",
       "4           0    39938\n",
       "5           0    52052\n",
       "6           0      488\n",
       "7           0    16342\n",
       "8           0    23523\n",
       "9           0    38284\n",
       "10          0    13809\n",
       "11          0    42227\n",
       "12          0    26351\n",
       "13          0    31157\n",
       "14          0    59947\n",
       "15          0    64169\n",
       "16          0    40624\n",
       "17          0    55150\n",
       "18          0    31262\n",
       "19          0    15222\n",
       "20          1    36138\n",
       "21          1    54264\n",
       "22          1    21625\n",
       "23          1    59519\n",
       "24          1    25389\n",
       "25          1    44537\n",
       "26          1    49690\n",
       "27          1    32351\n",
       "28          1    20547\n",
       "29          1    38629\n",
       "...       ...      ...\n",
       "1970       98    47896\n",
       "1971       98     6286\n",
       "1972       98    24001\n",
       "1973       98    62207\n",
       "1974       98     6839\n",
       "1975       98    63645\n",
       "1976       98    17491\n",
       "1977       98     7158\n",
       "1978       98    37085\n",
       "1979       98    35586\n",
       "1980       99    14035\n",
       "1981       99    47121\n",
       "1982       99    39555\n",
       "1983       99    30216\n",
       "1984       99    55830\n",
       "1985       99    21924\n",
       "1986       99    35114\n",
       "1987       99    15421\n",
       "1988       99    36699\n",
       "1989       99     5022\n",
       "1990       99    32555\n",
       "1991       99    29143\n",
       "1992       99    24740\n",
       "1993       99     6845\n",
       "1994       99    58348\n",
       "1995       99    54151\n",
       "1996       99    12884\n",
       "1997       99    38679\n",
       "1998       99    33084\n",
       "1999       99    27332\n",
       "\n",
       "[2000 rows x 2 columns]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "import pandas as pd\n",
    "\n",
    "train_dataframe = pd.DataFrame({\"user_id\":user_recommendations_user_id, \"item_id\":user_recommendations_items})\n",
    "train_dataframe"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Now let's add some features. For example, the prediction of another algorithm\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "from Base.NonPersonalizedRecommender import TopPop\n",
    "\n",
    "topPop = TopPop(URM_train)\n",
    "topPop.fit()\n",
    "\n",
    "\n",
    "topPop_score_list = []\n",
    "\n",
    "for user_id, item_id in zip(user_recommendations_user_id, user_recommendations_items):\n",
    "    \n",
    "    topPop_score = topPop.compute_score_top_pop([user_id])[0,item_id]\n",
    "    topPop_score_list.append(topPop_score)\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>item_id</th>\n",
       "      <th>item_popularity</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>53639</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>10643</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>20615</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>5706</td>\n",
       "      <td>6.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>39938</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0</td>\n",
       "      <td>52052</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0</td>\n",
       "      <td>488</td>\n",
       "      <td>175.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0</td>\n",
       "      <td>16342</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>0</td>\n",
       "      <td>23523</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0</td>\n",
       "      <td>38284</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>0</td>\n",
       "      <td>13809</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>0</td>\n",
       "      <td>42227</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>0</td>\n",
       "      <td>26351</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>0</td>\n",
       "      <td>31157</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>0</td>\n",
       "      <td>59947</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>0</td>\n",
       "      <td>64169</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>0</td>\n",
       "      <td>40624</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>0</td>\n",
       "      <td>55150</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>0</td>\n",
       "      <td>31262</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>0</td>\n",
       "      <td>15222</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>1</td>\n",
       "      <td>36138</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>1</td>\n",
       "      <td>54264</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>1</td>\n",
       "      <td>21625</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>1</td>\n",
       "      <td>59519</td>\n",
       "      <td>24.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>1</td>\n",
       "      <td>25389</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>1</td>\n",
       "      <td>44537</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>1</td>\n",
       "      <td>49690</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>1</td>\n",
       "      <td>32351</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>1</td>\n",
       "      <td>20547</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>1</td>\n",
       "      <td>38629</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970</th>\n",
       "      <td>98</td>\n",
       "      <td>47896</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1971</th>\n",
       "      <td>98</td>\n",
       "      <td>6286</td>\n",
       "      <td>339.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1972</th>\n",
       "      <td>98</td>\n",
       "      <td>24001</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1973</th>\n",
       "      <td>98</td>\n",
       "      <td>62207</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1974</th>\n",
       "      <td>98</td>\n",
       "      <td>6839</td>\n",
       "      <td>30.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1975</th>\n",
       "      <td>98</td>\n",
       "      <td>63645</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1976</th>\n",
       "      <td>98</td>\n",
       "      <td>17491</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1977</th>\n",
       "      <td>98</td>\n",
       "      <td>7158</td>\n",
       "      <td>563.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1978</th>\n",
       "      <td>98</td>\n",
       "      <td>37085</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1979</th>\n",
       "      <td>98</td>\n",
       "      <td>35586</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980</th>\n",
       "      <td>99</td>\n",
       "      <td>14035</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981</th>\n",
       "      <td>99</td>\n",
       "      <td>47121</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1982</th>\n",
       "      <td>99</td>\n",
       "      <td>39555</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1983</th>\n",
       "      <td>99</td>\n",
       "      <td>30216</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1984</th>\n",
       "      <td>99</td>\n",
       "      <td>55830</td>\n",
       "      <td>214.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1985</th>\n",
       "      <td>99</td>\n",
       "      <td>21924</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1986</th>\n",
       "      <td>99</td>\n",
       "      <td>35114</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1987</th>\n",
       "      <td>99</td>\n",
       "      <td>15421</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1988</th>\n",
       "      <td>99</td>\n",
       "      <td>36699</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1989</th>\n",
       "      <td>99</td>\n",
       "      <td>5022</td>\n",
       "      <td>47.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990</th>\n",
       "      <td>99</td>\n",
       "      <td>32555</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1991</th>\n",
       "      <td>99</td>\n",
       "      <td>29143</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1992</th>\n",
       "      <td>99</td>\n",
       "      <td>24740</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1993</th>\n",
       "      <td>99</td>\n",
       "      <td>6845</td>\n",
       "      <td>6.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1994</th>\n",
       "      <td>99</td>\n",
       "      <td>58348</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1995</th>\n",
       "      <td>99</td>\n",
       "      <td>54151</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1996</th>\n",
       "      <td>99</td>\n",
       "      <td>12884</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1997</th>\n",
       "      <td>99</td>\n",
       "      <td>38679</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1998</th>\n",
       "      <td>99</td>\n",
       "      <td>33084</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1999</th>\n",
       "      <td>99</td>\n",
       "      <td>27332</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2000 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      user_id  item_id  item_popularity\n",
       "0           0    53639              0.0\n",
       "1           0    10643              0.0\n",
       "2           0    20615              0.0\n",
       "3           0     5706              6.0\n",
       "4           0    39938              0.0\n",
       "5           0    52052              0.0\n",
       "6           0      488            175.0\n",
       "7           0    16342              0.0\n",
       "8           0    23523              0.0\n",
       "9           0    38284              0.0\n",
       "10          0    13809              0.0\n",
       "11          0    42227              0.0\n",
       "12          0    26351              0.0\n",
       "13          0    31157              0.0\n",
       "14          0    59947              0.0\n",
       "15          0    64169              0.0\n",
       "16          0    40624              0.0\n",
       "17          0    55150              0.0\n",
       "18          0    31262              0.0\n",
       "19          0    15222              0.0\n",
       "20          1    36138              0.0\n",
       "21          1    54264              0.0\n",
       "22          1    21625              0.0\n",
       "23          1    59519             24.0\n",
       "24          1    25389              0.0\n",
       "25          1    44537              0.0\n",
       "26          1    49690              0.0\n",
       "27          1    32351              0.0\n",
       "28          1    20547              0.0\n",
       "29          1    38629              0.0\n",
       "...       ...      ...              ...\n",
       "1970       98    47896              0.0\n",
       "1971       98     6286            339.0\n",
       "1972       98    24001              0.0\n",
       "1973       98    62207              0.0\n",
       "1974       98     6839             30.0\n",
       "1975       98    63645              1.0\n",
       "1976       98    17491              0.0\n",
       "1977       98     7158            563.0\n",
       "1978       98    37085              0.0\n",
       "1979       98    35586              0.0\n",
       "1980       99    14035              0.0\n",
       "1981       99    47121              0.0\n",
       "1982       99    39555              0.0\n",
       "1983       99    30216              0.0\n",
       "1984       99    55830            214.0\n",
       "1985       99    21924              0.0\n",
       "1986       99    35114              0.0\n",
       "1987       99    15421              0.0\n",
       "1988       99    36699              0.0\n",
       "1989       99     5022             47.0\n",
       "1990       99    32555              0.0\n",
       "1991       99    29143              0.0\n",
       "1992       99    24740              0.0\n",
       "1993       99     6845              6.0\n",
       "1994       99    58348              0.0\n",
       "1995       99    54151              0.0\n",
       "1996       99    12884              0.0\n",
       "1997       99    38679              0.0\n",
       "1998       99    33084              0.0\n",
       "1999       99    27332              0.0\n",
       "\n",
       "[2000 rows x 3 columns]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_dataframe['item_popularity'] = pd.Series(topPop_score_list, index=train_dataframe.index)\n",
    "train_dataframe"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Or the profile length"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "user_profile_len = np.ediff1d(URM_train.indptr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "user_profile_len_list = []\n",
    "\n",
    "target_feature = 1\n",
    "\n",
    "for user_id, item_id in zip(user_recommendations_user_id, user_recommendations_items):\n",
    "    \n",
    "    user_profile_len_list.append(user_profile_len[user_id])\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>item_id</th>\n",
       "      <th>item_popularity</th>\n",
       "      <th>user_profile_len</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>53639</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>10643</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>20615</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>5706</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>39938</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0</td>\n",
       "      <td>52052</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0</td>\n",
       "      <td>488</td>\n",
       "      <td>175.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0</td>\n",
       "      <td>16342</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>0</td>\n",
       "      <td>23523</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0</td>\n",
       "      <td>38284</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>0</td>\n",
       "      <td>13809</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>0</td>\n",
       "      <td>42227</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>0</td>\n",
       "      <td>26351</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>0</td>\n",
       "      <td>31157</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>0</td>\n",
       "      <td>59947</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>0</td>\n",
       "      <td>64169</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>0</td>\n",
       "      <td>40624</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>0</td>\n",
       "      <td>55150</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>0</td>\n",
       "      <td>31262</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>0</td>\n",
       "      <td>15222</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>1</td>\n",
       "      <td>36138</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>1</td>\n",
       "      <td>54264</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>1</td>\n",
       "      <td>21625</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>1</td>\n",
       "      <td>59519</td>\n",
       "      <td>24.0</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>1</td>\n",
       "      <td>25389</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>1</td>\n",
       "      <td>44537</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>1</td>\n",
       "      <td>49690</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>1</td>\n",
       "      <td>32351</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>1</td>\n",
       "      <td>20547</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>1</td>\n",
       "      <td>38629</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970</th>\n",
       "      <td>98</td>\n",
       "      <td>47896</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1971</th>\n",
       "      <td>98</td>\n",
       "      <td>6286</td>\n",
       "      <td>339.0</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1972</th>\n",
       "      <td>98</td>\n",
       "      <td>24001</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1973</th>\n",
       "      <td>98</td>\n",
       "      <td>62207</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1974</th>\n",
       "      <td>98</td>\n",
       "      <td>6839</td>\n",
       "      <td>30.0</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1975</th>\n",
       "      <td>98</td>\n",
       "      <td>63645</td>\n",
       "      <td>1.0</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1976</th>\n",
       "      <td>98</td>\n",
       "      <td>17491</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1977</th>\n",
       "      <td>98</td>\n",
       "      <td>7158</td>\n",
       "      <td>563.0</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1978</th>\n",
       "      <td>98</td>\n",
       "      <td>37085</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1979</th>\n",
       "      <td>98</td>\n",
       "      <td>35586</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980</th>\n",
       "      <td>99</td>\n",
       "      <td>14035</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981</th>\n",
       "      <td>99</td>\n",
       "      <td>47121</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1982</th>\n",
       "      <td>99</td>\n",
       "      <td>39555</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1983</th>\n",
       "      <td>99</td>\n",
       "      <td>30216</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1984</th>\n",
       "      <td>99</td>\n",
       "      <td>55830</td>\n",
       "      <td>214.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1985</th>\n",
       "      <td>99</td>\n",
       "      <td>21924</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1986</th>\n",
       "      <td>99</td>\n",
       "      <td>35114</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1987</th>\n",
       "      <td>99</td>\n",
       "      <td>15421</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1988</th>\n",
       "      <td>99</td>\n",
       "      <td>36699</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1989</th>\n",
       "      <td>99</td>\n",
       "      <td>5022</td>\n",
       "      <td>47.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990</th>\n",
       "      <td>99</td>\n",
       "      <td>32555</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1991</th>\n",
       "      <td>99</td>\n",
       "      <td>29143</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1992</th>\n",
       "      <td>99</td>\n",
       "      <td>24740</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1993</th>\n",
       "      <td>99</td>\n",
       "      <td>6845</td>\n",
       "      <td>6.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1994</th>\n",
       "      <td>99</td>\n",
       "      <td>58348</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1995</th>\n",
       "      <td>99</td>\n",
       "      <td>54151</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1996</th>\n",
       "      <td>99</td>\n",
       "      <td>12884</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1997</th>\n",
       "      <td>99</td>\n",
       "      <td>38679</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1998</th>\n",
       "      <td>99</td>\n",
       "      <td>33084</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1999</th>\n",
       "      <td>99</td>\n",
       "      <td>27332</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2000 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      user_id  item_id  item_popularity  user_profile_len\n",
       "0           0    53639              0.0                 0\n",
       "1           0    10643              0.0                 0\n",
       "2           0    20615              0.0                 0\n",
       "3           0     5706              6.0                 0\n",
       "4           0    39938              0.0                 0\n",
       "5           0    52052              0.0                 0\n",
       "6           0      488            175.0                 0\n",
       "7           0    16342              0.0                 0\n",
       "8           0    23523              0.0                 0\n",
       "9           0    38284              0.0                 0\n",
       "10          0    13809              0.0                 0\n",
       "11          0    42227              0.0                 0\n",
       "12          0    26351              0.0                 0\n",
       "13          0    31157              0.0                 0\n",
       "14          0    59947              0.0                 0\n",
       "15          0    64169              0.0                 0\n",
       "16          0    40624              0.0                 0\n",
       "17          0    55150              0.0                 0\n",
       "18          0    31262              0.0                 0\n",
       "19          0    15222              0.0                 0\n",
       "20          1    36138              0.0                11\n",
       "21          1    54264              0.0                11\n",
       "22          1    21625              0.0                11\n",
       "23          1    59519             24.0                11\n",
       "24          1    25389              0.0                11\n",
       "25          1    44537              0.0                11\n",
       "26          1    49690              0.0                11\n",
       "27          1    32351              0.0                11\n",
       "28          1    20547              0.0                11\n",
       "29          1    38629              0.0                11\n",
       "...       ...      ...              ...               ...\n",
       "1970       98    47896              0.0                14\n",
       "1971       98     6286            339.0                14\n",
       "1972       98    24001              0.0                14\n",
       "1973       98    62207              0.0                14\n",
       "1974       98     6839             30.0                14\n",
       "1975       98    63645              1.0                14\n",
       "1976       98    17491              0.0                14\n",
       "1977       98     7158            563.0                14\n",
       "1978       98    37085              0.0                14\n",
       "1979       98    35586              0.0                14\n",
       "1980       99    14035              0.0                17\n",
       "1981       99    47121              0.0                17\n",
       "1982       99    39555              0.0                17\n",
       "1983       99    30216              0.0                17\n",
       "1984       99    55830            214.0                17\n",
       "1985       99    21924              0.0                17\n",
       "1986       99    35114              0.0                17\n",
       "1987       99    15421              0.0                17\n",
       "1988       99    36699              0.0                17\n",
       "1989       99     5022             47.0                17\n",
       "1990       99    32555              0.0                17\n",
       "1991       99    29143              0.0                17\n",
       "1992       99    24740              0.0                17\n",
       "1993       99     6845              6.0                17\n",
       "1994       99    58348              0.0                17\n",
       "1995       99    54151              0.0                17\n",
       "1996       99    12884              0.0                17\n",
       "1997       99    38679              0.0                17\n",
       "1998       99    33084              0.0                17\n",
       "1999       99    27332              0.0                17\n",
       "\n",
       "[2000 rows x 4 columns]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_dataframe['user_profile_len'] = pd.Series(user_profile_len_list, index=train_dataframe.index)\n",
    "train_dataframe"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## the same can be done with item features\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "feature_1_list = []\n",
    "\n",
    "target_feature = 1\n",
    "\n",
    "for user_id, item_id in zip(user_recommendations_user_id, user_recommendations_items):\n",
    "    \n",
    "    item_features = ICM_all[item_id,:]\n",
    "    \n",
    "    if target_feature in item_features.indices:\n",
    "        feature_1_list.append(1)\n",
    "    else:\n",
    "        feature_1_list.append(0)    \n",
    "    \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>item_id</th>\n",
       "      <th>item_popularity</th>\n",
       "      <th>user_profile_len</th>\n",
       "      <th>item_feature_1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>53639</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>10643</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>20615</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>5706</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>39938</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0</td>\n",
       "      <td>52052</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0</td>\n",
       "      <td>488</td>\n",
       "      <td>175.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0</td>\n",
       "      <td>16342</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>0</td>\n",
       "      <td>23523</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0</td>\n",
       "      <td>38284</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>0</td>\n",
       "      <td>13809</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>0</td>\n",
       "      <td>42227</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>0</td>\n",
       "      <td>26351</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>0</td>\n",
       "      <td>31157</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>0</td>\n",
       "      <td>59947</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>0</td>\n",
       "      <td>64169</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>0</td>\n",
       "      <td>40624</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>0</td>\n",
       "      <td>55150</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>0</td>\n",
       "      <td>31262</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>0</td>\n",
       "      <td>15222</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>1</td>\n",
       "      <td>36138</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>1</td>\n",
       "      <td>54264</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>1</td>\n",
       "      <td>21625</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>1</td>\n",
       "      <td>59519</td>\n",
       "      <td>24.0</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>1</td>\n",
       "      <td>25389</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>1</td>\n",
       "      <td>44537</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>1</td>\n",
       "      <td>49690</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>1</td>\n",
       "      <td>32351</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>1</td>\n",
       "      <td>20547</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>1</td>\n",
       "      <td>38629</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970</th>\n",
       "      <td>98</td>\n",
       "      <td>47896</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1971</th>\n",
       "      <td>98</td>\n",
       "      <td>6286</td>\n",
       "      <td>339.0</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1972</th>\n",
       "      <td>98</td>\n",
       "      <td>24001</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1973</th>\n",
       "      <td>98</td>\n",
       "      <td>62207</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1974</th>\n",
       "      <td>98</td>\n",
       "      <td>6839</td>\n",
       "      <td>30.0</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1975</th>\n",
       "      <td>98</td>\n",
       "      <td>63645</td>\n",
       "      <td>1.0</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1976</th>\n",
       "      <td>98</td>\n",
       "      <td>17491</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1977</th>\n",
       "      <td>98</td>\n",
       "      <td>7158</td>\n",
       "      <td>563.0</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1978</th>\n",
       "      <td>98</td>\n",
       "      <td>37085</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1979</th>\n",
       "      <td>98</td>\n",
       "      <td>35586</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980</th>\n",
       "      <td>99</td>\n",
       "      <td>14035</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981</th>\n",
       "      <td>99</td>\n",
       "      <td>47121</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1982</th>\n",
       "      <td>99</td>\n",
       "      <td>39555</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1983</th>\n",
       "      <td>99</td>\n",
       "      <td>30216</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1984</th>\n",
       "      <td>99</td>\n",
       "      <td>55830</td>\n",
       "      <td>214.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1985</th>\n",
       "      <td>99</td>\n",
       "      <td>21924</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1986</th>\n",
       "      <td>99</td>\n",
       "      <td>35114</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1987</th>\n",
       "      <td>99</td>\n",
       "      <td>15421</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1988</th>\n",
       "      <td>99</td>\n",
       "      <td>36699</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1989</th>\n",
       "      <td>99</td>\n",
       "      <td>5022</td>\n",
       "      <td>47.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990</th>\n",
       "      <td>99</td>\n",
       "      <td>32555</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1991</th>\n",
       "      <td>99</td>\n",
       "      <td>29143</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1992</th>\n",
       "      <td>99</td>\n",
       "      <td>24740</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1993</th>\n",
       "      <td>99</td>\n",
       "      <td>6845</td>\n",
       "      <td>6.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1994</th>\n",
       "      <td>99</td>\n",
       "      <td>58348</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1995</th>\n",
       "      <td>99</td>\n",
       "      <td>54151</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1996</th>\n",
       "      <td>99</td>\n",
       "      <td>12884</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1997</th>\n",
       "      <td>99</td>\n",
       "      <td>38679</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1998</th>\n",
       "      <td>99</td>\n",
       "      <td>33084</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1999</th>\n",
       "      <td>99</td>\n",
       "      <td>27332</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2000 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      user_id  item_id  item_popularity  user_profile_len  item_feature_1\n",
       "0           0    53639              0.0                 0               0\n",
       "1           0    10643              0.0                 0               0\n",
       "2           0    20615              0.0                 0               0\n",
       "3           0     5706              6.0                 0               0\n",
       "4           0    39938              0.0                 0               0\n",
       "5           0    52052              0.0                 0               0\n",
       "6           0      488            175.0                 0               0\n",
       "7           0    16342              0.0                 0               0\n",
       "8           0    23523              0.0                 0               0\n",
       "9           0    38284              0.0                 0               0\n",
       "10          0    13809              0.0                 0               0\n",
       "11          0    42227              0.0                 0               0\n",
       "12          0    26351              0.0                 0               0\n",
       "13          0    31157              0.0                 0               0\n",
       "14          0    59947              0.0                 0               0\n",
       "15          0    64169              0.0                 0               0\n",
       "16          0    40624              0.0                 0               0\n",
       "17          0    55150              0.0                 0               0\n",
       "18          0    31262              0.0                 0               0\n",
       "19          0    15222              0.0                 0               0\n",
       "20          1    36138              0.0                11               0\n",
       "21          1    54264              0.0                11               0\n",
       "22          1    21625              0.0                11               0\n",
       "23          1    59519             24.0                11               0\n",
       "24          1    25389              0.0                11               0\n",
       "25          1    44537              0.0                11               0\n",
       "26          1    49690              0.0                11               0\n",
       "27          1    32351              0.0                11               0\n",
       "28          1    20547              0.0                11               0\n",
       "29          1    38629              0.0                11               0\n",
       "...       ...      ...              ...               ...             ...\n",
       "1970       98    47896              0.0                14               0\n",
       "1971       98     6286            339.0                14               0\n",
       "1972       98    24001              0.0                14               0\n",
       "1973       98    62207              0.0                14               0\n",
       "1974       98     6839             30.0                14               0\n",
       "1975       98    63645              1.0                14               0\n",
       "1976       98    17491              0.0                14               0\n",
       "1977       98     7158            563.0                14               0\n",
       "1978       98    37085              0.0                14               0\n",
       "1979       98    35586              0.0                14               0\n",
       "1980       99    14035              0.0                17               0\n",
       "1981       99    47121              0.0                17               0\n",
       "1982       99    39555              0.0                17               0\n",
       "1983       99    30216              0.0                17               0\n",
       "1984       99    55830            214.0                17               0\n",
       "1985       99    21924              0.0                17               0\n",
       "1986       99    35114              0.0                17               0\n",
       "1987       99    15421              0.0                17               0\n",
       "1988       99    36699              0.0                17               0\n",
       "1989       99     5022             47.0                17               0\n",
       "1990       99    32555              0.0                17               0\n",
       "1991       99    29143              0.0                17               0\n",
       "1992       99    24740              0.0                17               0\n",
       "1993       99     6845              6.0                17               0\n",
       "1994       99    58348              0.0                17               0\n",
       "1995       99    54151              0.0                17               0\n",
       "1996       99    12884              0.0                17               0\n",
       "1997       99    38679              0.0                17               0\n",
       "1998       99    33084              0.0                17               0\n",
       "1999       99    27332              0.0                17               0\n",
       "\n",
       "[2000 rows x 5 columns]"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_dataframe['item_feature_1'] = pd.Series(feature_1_list, index=train_dataframe.index)\n",
    "train_dataframe"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Then you can train XGBoost to rerank those prediction using as lable whether they should be recommended or not"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
